debug 函数只在生产平台在页面输出调试信息
调试类 clDebug 提供调试函数,只在生产平台在页面输出调试信息,生产平台,调试信息输出到日志文件。
示例:include/test/debug.php
<?php
include("pub/debug.inc");
_debug("hehe");
_debug("hehe","xxx");
$debug=new clDebug();
$debug->timer_init();
for ($i=0; $i<10000; $i++);
_debug("\$i",$i);
$debug->timer_during();
//$debug->set_log("c:/php.debug.html");
for ($i=0; $i<100000; $i++);
_debug("\$i",$i);
$debug->timer_during();
$debug->timer_total();
phpinfo();
?>
display_errors 和 display_startup_errors 的设置
在开发平台,设置 display_errors 和 display_startup_errors 为 On; 在生产平台,设置 display_errors 和 display_startup_errors 为 Off。
目的是在开发平台能够将PHP报错信息直接显示在网页上。
error_reporting 的设置
在开发平台,设置 error_reporting 为 error_reporting = E_ALL; 在生产平台,设置 error_reporting 为 error_reporting = E_ALL & ~E_NOTICE。
目的是在开发平台能够报告PHP语法上的警告信息。
Copyright © 2006 WorldHello 开放文档之源 计划 |