php.iniÖн« display_errors = Off ¸ÄΪdisplay_errors = On
»òÕß ini_set('display_errors',0);
Æä´Î£¬ÎÒÃÇÖªµÀphpµÄ´íÎ󼶱ðÊÇÓÉerror_reporting¡¾error_reportingÏêϸ½Ì³Ì¡¿¿ØÖƵģ¬µ«ÊÇÓкܶàÈËÔÚÉú²ú»·¾³¹Ø±ÕÁË´íÎóÐÅÏ¢Ìáʾ
error_reporting(0);
ÆäʵÕâÖÖ×ö·¨£¬ÎÒ¾õµÃ²»¿Æѧ£¬ÔÚcodeigniter¿ò¼Ü¾ÍÊÇÕâÑù£º
if (defined('ENVIRONMENT')) { switch (ENVIRONMENT) { case 'development': error_reporting(E_ALL); break; case 'testing': case 'production': error_reporting(0); break; default: exit('The application environment is not set correctly.'); } }ÏßÉϵĴíÎóÐÅÏ¢¿Ï¶¨ÊÇÒª¼Ç¼µÄ£¬error_reporting(0)ÕâÑù»áµ¼ÖÂËùÓеĴíÎóÐÅÏ¢²»»á¼Ç¼£¬Ó¦¸Ã£ºerror_reporting = E_ALL & ~E_NOTICE£¬Ö»Òªdisplay_errors = Off£¬´íÎóÐÅÏ¢¾Í²»»áÔÙÒ³ÃæÉÏÏÔʾ£¬ÒòΪdisplay_errorsµÄÓÅÏȼ¶±ð¸ü¸ß¡£
ÌرðҪעÒâµÄÊÇ:
Èç¹ûphp.iniÖÐlog_errors= On£¬¾Ý¹Ù·½µÄ˵·¨£¬ÄÇô±ØÐëÖ¸¶¨error_logÎļþ£¬Èç¹ûûָ¶¨»òÕßÖ¸¶¨µÄÎļþûÓÐȨÏÞдÈ룬ÄÇôÕÕÑù»áÊä³öµ½Õý³£µÄÊä³öÇþµÀ£¬ÄÇôҲ¾ÍʹµÃdisplay_errors Õâ¸öÖ¸¶¨µÄOffʧЧ£¬´íÎóÐÅÏ¢»¹ÊÇ´òÓ¡Á˳öÀ´¡£½«log_errors = Off¾ÍÐÐÁË¡£
×ܽáÏ£¬ÔÚÉú²ú»·¾³Öв»ÏÖʵ´íÎóÐÅÏ¢»¹ÄܼǼ´íÎóÈÕÖ¾£º
<?php /** * ¼Ç¼Éú²ú»·¾³´íÎóÈÕÖ¾ * * @link http://www.phpddt.com */ error_reporting(E_ALL); ini_set('display_errors',0); ini_set('log_errors',1); ini_set('error_log','E:\\'.date('Y-m-d').'_phpddt.com.txt');2¡¢phpÆÕͨ´íÎó¼°ÖÂÃü´íÎóµÄ²¶»ñºÍ¼Ç¼
<?php //½ûÖ¹´íÎóÊä³ö error_reporting(0); //ÉèÖôíÎó´¦ÀíÆ÷ set_error_handler('errorHandler'); register_shutdown_function('fatalErrorHandler'); class Test{ public function index(){ //ÕâÀï·¢ÉúÒ»¸ö¾¯¸æ´íÎ󣬳ö·¢errorHandler echo $undefinedVarible; } } function errorHandler($errno,$errstr,$errfile,$errline){ $arr = array( '['.date('Y-m-d h-i-s').']', 'http://www.baidu.com', '|', $errstr, $errfile, 'line:'.$errline, ); //дÈë´íÎóÈÕÖ¾ //¸ñʽ £º ʱ¼ä uri | ´íÎóÏûÏ¢ ÎļþλÖà µÚ¼¸ÐÐ error_log(implode(' ',$arr)."\r\n",3,'./test.txt','extra'); echo implode(' ',$arr)."\r\n"; } //²¶»ñfatalError function fatalErrorHandler(){ $e = error_get_last(); switch($e['type']){ case E_ERROR: case E_PARSE: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: errorHandler($e['type'],$e['message'],$e['file'],$e['line']); break; } } $test = new Test(); ////ÕâÀï·¢ÉúÒ»¸ö¾¯¸æ´íÎó,±»errorHandler ²¶»ñ $test->index(); //·¢ÉúÖÂÃü´íÎ󣬽ű¾Í£Ö¹ÔËÐд¥·¢ fatalErrorHandler $test = new Tesdt(); $test->index();
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ