1. 程式人生 > >php輸出所有錯誤資訊

php輸出所有錯誤資訊

方法一 修改php.ini

;顯示錯誤資訊
display_errors = On
;顯示php開始錯誤資訊
display_startup_errors = On
;日誌記錄錯誤資訊
log_errors = On


方法二 需要除錯的php檔案首行中加入

ini_set('display_errors',1);            //錯誤資訊
ini_set('display_startup_errors',1);    //php啟動錯誤資訊
error_reporting(-1);                    //打印出所有的 錯誤資訊
ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); //將出錯資訊輸出到一個文字檔案