|
PS:
1.捕獲php語(yǔ)法錯(cuò)誤
2.嚴(yán)重錯(cuò)誤
用正常的 set_error_handle無(wú)法捕獲此兩類錯(cuò)誤,這是捕獲此類錯(cuò)誤的技巧
復(fù)制代碼 代碼如下:
//test.php 頁(yè)面
error_reporting(0);
register_shutdown_function('PageOnShutdown');
include('error_test.php');
function PageOnShutdown()
{
$msg = error_get_last();
print_r($msg);
}
//error_test.php 頁(yè)面
$a = 1 + 2
$b
然后 輸出 test.php 打印出
Array ( [type] => 4 [message] => parse error [file] => D:/web/tbc/error_test.php [line] => 5 )
再根據(jù) 獲得 $msg 寫入日志操作就可以了
php技術(shù):探討捕獲php錯(cuò)誤信息方法的詳解,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。