关闭错误报告 php

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10711517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 22:52:17  来源:igfitidea点击:

Turning error reporting off php

php

提问by fuddin

I wanted to turn off the error reporting on a website. Googling for it I found that placing the code mentioned below in the website stops the errors from getting displayed on the screen. I placed it into my website but it did not work. Please help me out. Thanks

我想关闭网站上的错误报告。谷歌搜索我发现将下面提到的代码放在网站中会阻止错误显示在屏幕上。我把它放在我的网站上,但没有用。请帮帮我。谢谢

<?php

error_reporting(0); // Turn off all error reporting

?>

回答by belgianguy

Tried this yet?

试过这个了吗?

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

回答by Jrom

Does this work?

这行得通吗?

display_errors = Off

Also, what version of php are you using?

另外,你用的是什么版本的php?

回答by Matthew

Read up on the configuration settings(e.g., display_errors, display_startup_errors, log_errors) and update your php.inior .htaccessor .user.inifile, whichever is appropriate.

阅读配置设置(例如,display_errorsdisplay_startup_errorslog_errors)并更新您的php.ini.htaccess.user.ini文件,以适当的为准。

It works.

有用。