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

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

问题描述

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

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

我已经尝试使用 .htacess,将代码 php_flag display_errors off 放在那里,但它返回一个 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天全站免登陆