本文介紹了在生產服務器上抑制 php 錯誤的最佳方法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
在瀏覽器上隱藏 php 錯誤的最佳方法是什么?
What is the best method of hiding php errors from being displayed on the browser?
是否會使用以下內容:
ini_set("display_errors", 1);
任何最佳實踐提示也將不勝感激!
Any best practice tips would be appreciated as well!
我正在記錄錯誤,我只是想確保將 display_errors 值設置為 off(或 0)不會阻止記錄錯誤.
I am logging the errors, I just want to make sure that setting the display_errors value to off (or 0) will not prevent errors from being logged.
推薦答案
最好的方法是記錄您的錯誤,而不是顯示或忽略它們.
The best way is to log your errors instead of displaying or ignoring them.
此示例會將錯誤記錄到系統日志中,而不是在瀏覽器中顯示它們.
This example will log the errors to syslog instead of displaying them in the browser.
ini_set("display_errors", 0);
ini_set("log_errors", 1);
//Define where do you want the log to go, syslog or a file of your liking with
ini_set("error_log", "syslog"); // or ini_set("error_log", "/path/to/syslog/file");
這篇關于在生產服務器上抑制 php 錯誤的最佳方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!