0
這是代碼,在全球範圍內:爲什麼這個全局函數不能訪問我的全局對象?
try {
$Core = new Core;
} catch(Exception $e) {
echo 'We\'re Sorry, but an error has occurred: <br /> '.$e. "\n";
}
function PP($Object){
global $Core;
echo '<pre>'.$Core->Tools()->DebugPrint($Object).'</pre>';
}
我也得到:
Call to a member function Tools() on a non-object
這是沒有意義的。爲什麼PP
函數不能訪問全局的$Core
對象?
你在哪裏定義$核心對象? –
@cyber_rookie查看代碼的第二行.. –
唯一的解釋是「這是全局範圍內的代碼:」 - 它不在全局範圍內 – zerkms