php怎么输出错误提示
2022-12-02 09:01:16
142
{{single.collect_count}}

php输出错误提示的方法:1、打开相应的PHP文件;2、添加“error_reporting(E_ALL);”;3、通过“function cache_shutdown_error() {...}”方法输出错误信息即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

本文操作环境:windows7系统、PHP7.1版、DELL G3电脑

php怎么输出错误提示?

php输出错误信息

error_reporting(E_ALL);function cache_shutdown_error() {$_error = error_get_last();if ($_error && in_array($_error['type'], array(1, 4, 16, 64, 256, 4096, E_ALL))){header("Content-Type: text/html; charset=utf-8");echo '<font color=red>你的代码出错了:</font></br>';echo '致命错误:' . $_error['message'] . '</br>';echo '文件:' . $_error['file'] . '</br>';echo '在第' . $_error['line'] . '行</br>';}} register_shutdown_function("cache_shutdown_error");
登录后复制

最好放在最前面,如果报错就终止了,就无法执行这个方法

推荐学习:《PHP视频教程

以上就是php怎么输出错误提示的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}