《PHP編程:php獲取錯誤信息的方法》要點:
本文介紹了PHP編程:php獲取錯誤信息的方法,希望對您有用。如果有疑問,可以聯系我們。
本文實例講述了php獲取錯誤信息的辦法.分享給大家供大家參考.具體如下:PHP實戰
function error_reg(){ $ar=array( E_ERROR => 'error', E_WARNING => 'warning', E_PARSE =>'prase', E_NOTICE => 'notice' ); register_shutdown_function(function() use ($ar){ $ers=error_get_last(); if($ers['type']!=8 && $ers['type']){ $er=$ar[$ers['type']].$ers['type'].': '.' '.$ers['message'].' => '.$ers['file'].' line:'.$ers['line'].' '.date('Y-m-d H:i:s')."\n"; error_log($er,3,'/tmp/php_error.log'); } }); set_error_handler(function($a,$b,$c,$d) use ($ar){ if($a!=8 && $a){ $er=$ar[$a].$a.': '.$b.' => '.$c.' line:'.$d.' '.date('Y-m-d H:i:s')."\n"; error_log($er,3,'/tmp/php_error.log'); } },E_ALL ^ E_NOTICE); }
希望本文所述對大家的php程序設計有所贊助.PHP實戰
歡迎參與《PHP編程:php獲取錯誤信息的方法》討論,分享您的想法,維易PHP學院為您提供專業教程。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/9457.html