php查看错误的方法:1、通过配置【php.ini】中的参数设置PHP的报错级别可以在php.ini中适当的位置增加一行;2、通过PHP函数【error_reporting】设定PHP报错级别。
php查看错误的方法:
一、通过配置php.ini中的参数设置PHP的报错级别可以在php.ini中适当的位置增加一行
error_reporting=E_ALL CODE:[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如何查看错误的详细内容。更多信息请关注PHP中文网其他相关文章!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

记事本++7.3.1
好用且免费的代码编辑器

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境