這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)怎么在php項(xiàng)目中獲取錯(cuò)誤信息,文章內(nèi)容豐富且以專(zhuān)業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
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項(xiàng)目中獲取錯(cuò)誤信息了,如果剛好有類(lèi)似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。