我試圖在函數中使用已初始化的類,只傳遞給所述函數的類的字符串名稱。僅將類的名稱作爲字符串的訪問類
例子:
class art{
var $moduleInfo = "Hello World";
}
$art = new Art;
getModuleInfo("art");
function getModuleInfo($moduleName){
//I know I need something to happen right here. I don't want to reinitialize the class since it has already been done. I would just like to make it accessible within this function.
echo $moduleName->moduleInfo;
}
感謝您的幫助!