您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 随州分类信息网,免费分类信息发布

php如何查看错误

2024/7/23 19:42:42发布33次查看
php查看错误的方法:1、通过配置【php.ini】中的参数设置php的报错级别可以在php.ini中适当的位置增加一行;2、通过php函数【error_reporting】设定php报错级别。
php查看错误的方法:
一、通过配置php.ini中的参数设置php的报错级别可以在php.ini中适当的位置增加一行
error_reporting=e_allcode:[copy]error_reporting=e_all
注:php.ini中实现给出了一些例子,比如我本地的php.ini中就有如下
;examples:
;-show all errors,except for notices and coding standards warnings
;error_reporting=e_all&~e_notice
;-show all errors,except for notices
;error_reporting=e_all&~e_notice|e_strict
;-show only errors
;error_reporting=e_compile_error|e_recoverable_error|e_error|e_core_error
;-show all errors except for notices and coding standards warnings
;error_reporting=e_all&~e_notice
code:[copy]
;examples:
;-show all errors,except for notices and coding standards warnings
;error_reporting=e_all&~e_notice
;-show all errors,except for notices
;error_reporting=e_all&~e_notice|e_strict
;-show only errors
;error_reporting=e_compile_error|e_recoverable_error|e_error|e_core_error
;-show all errors except for notices and coding standards warnings
;error_reporting=e_all&~e_notice
我只要在这些行代码的下面增加error_reporting=e_all然后重新启动web服务就可以了
二、通过php函数error_reporting设定php报错级别
如果你无权修改php.ini中的参数配置,你可以通过这个函数来设置报错级别。
error_reporting()函数使用方法
error_reporting(report_level)
如果参数level未指定,当前报错级别将被返回。
任意数目的以上选项都可以用“或”来连接(用or或|),这样可以报告所有需要的各级别错误。例如,下面的代码关闭了用户自定义的错误和警告,执行了某些操作,然后恢复到原始的报错级别:
//禁用错误报告
error_reporting(0);
//报告运行时错误
error_reporting(e_error|e_warning|e_parse);
//报告所有错误
error_reporting(e_all);
code:[copy]
//禁用错误报告
error_reporting(0);
//报告运行时错误
error_reporting(e_error | e_warning | e_parse);
//报告所有错误
error_reporting(e_all);
那么我们就可以把论坛里的include/common.inc.php文件里的
error_reporting(0);code:[copy]error_reporting(0);
修改成
error_reporting(e_all);code:[copy]error_reporting(e_all);
然后保存,这样就可以看到 php 报告的错误信息了
想了解更多编程学习,敬请关注php培训栏目!
以上就是php如何查看错误的详细内容。
随州分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录