我有set_error_handler()
函數設置爲在發生錯誤時調用函數。set_error_handler函數不調用自動加載
在這種功能,我有我自己實現的異常類:
function acs_error_handler($errno, $errstr, $errfile, $errline) {
throw new acs_exception($errstr, $errno);
}
這給了我下面的錯誤:
Fatal error: Class 'acs_exception' not found
出於某種原因,該功能不叫我的自動加載功能我已經設置使用:
spl_autoload_register('__autoload');
如果我添加行:
__autoload('acs_exception');
在調用錯誤函數中的類之前,它都可以工作。
我的問題是:當我在錯誤觸發函數中調用acs_exception類時,應該不會觸發__autoload()
函數?
順便說一句,您可以在名稱之前連續指定多少個下劃線,然後難以確切知道有多少個下劃線? – 2009-12-21 20:45:12
我不得不添加額外的_因爲預覽變得混亂了。 – AntonioCS 2009-12-21 20:59:03