PHP的隐藏所有错误 [英] php hide ALL errors

查看:308
本文介绍了PHP的隐藏所有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是隐藏的所有 PHP错误的最佳做法?因为我不希望错误显示给用户。

what are the best practises for hiding all php errors? As I don't want ERRORS to show to the user.

我已经尝试使用了 .htacess 通过将code 的php_flag的display_errors关闭在那里,但它返回我一个 500错误

I've tried using the .htacess by putting the code php_flag display_errors off in there, but it returns me a 500 error.

有没有将隐藏的所有错误任何其他的方法呢?

Are there any other methods that will hide all errors?

推荐答案

要隐藏所有错误:

error_reporting(0);
ini_set('display_errors', 0);

要显示所有错误:

error_reporting(E_ALL);
ini_set('display_errors', 1);

这篇关于PHP的隐藏所有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆