問題描述
由于我無法控制的原因,我無法在我的生產服務器上的 php.ini 中設置 display_errors=0 和 log_errors=1.我知道我可以設置 error_reporting(0);
以完全抑制所有錯誤消息,但這會影響日志錯誤和顯示的錯誤.我希望有一個等價于在運行時設置 display_errors=0 和 log_errors=1 .這可能嗎?謝謝.
For reasons outside my control I am unable to set display_errors=0 and log_errors=1 in php.ini on my production server. I know I can set error_reporting(0);
to completely suppress all error messages, but this impacts both the log errors and the displayed errors. I was hoping there would be an equivalent to setting display_errors=0 and log_errors=1 at runtime. Is this possible? Thanks.
推薦答案
兩者都是 PHP_INI_ALL
,所以你可以只使用 ini_set
在運行時.
Both are PHP_INI_ALL
, so you can just use ini_set
at runtime.
ini_set('display_errors', 0);
ini_set('log_errors', 1);
參見http://php.net/manual/en/ini.list.php
這篇關于在沒有 php.ini 的情況下設置 display_errors=0 和 log_errors=1的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!