i 希望在浏览器上显示错误记录。
目前发生错误或警告/通知时,就会产生标志,并向浏览器展示错误,但想迫使系统不要向现场访问者展示浏览器中的错误信息,而是为我制造标志。
Thanks
i 希望在浏览器上显示错误记录。
目前发生错误或警告/通知时,就会产生标志,并向浏览器展示错误,但想迫使系统不要向现场访问者展示浏览器中的错误信息,而是为我制造标志。
Thanks
• 确保你在你的实验室中拥有这样的东西:
display_errors = Off
error_log = /var/log/php/error.log # Assuming you have /var/log/php directory and it s writable by httpd
error_reporting = E_ALL & ~E_DEPRECATED
Or set them as run-time options with ini_set()
在您的发言稿上加上:
//don t display errors
ini_set( display_errors , 0);
//write errors to log
ini_set( log_errors , 1);
//error log file name
ini_set( log_errors , /var/log/php/error.log );
error_reporting(E_ALL);
审判
error_reporting(E_ERROR | E_PARSE);
如果你想要记录习俗错误:
try {
// your code here
} catch (Exception $e){
error_log($e->getMessage(), $e->getCode(), $e->getFile(). Line .$e->getLine());
}
其他使用user4035 度。
如果有人想在2023年之后如何做到这一点,那就是一个迅速的说明,那就是,所有<代码>ini_set(<>>>>>的答案只能从执行之日起算。
这意味着,档案馆内产生的错误可能仍被送至浏览器,当然,这些错误可能是最常见的错误。
这方面的通常固定办法,视贵版本的购买力平价和名称的不同而大不相同;但是,这种固定办法总是会变异,包含有php环境的文件;例如,<代码>php.ini。 请将此碎块添加到php.ini
文档中:
display_errors = Off
log_errors = On
这将抑制浏览器的错误,同时使伐木得以存档。 您可能还需要添加以下条目:error_log = 错误_log
。
The title is horrible, i know; I m terrible at titles on SO here. I m wondering what would be the best way to present unified error responses in a webapi when errors could be raised deep inside the ...
I had an exception in some code today: "A [some exception] was unhandled." However, this code was clearly inside the "try" block of a "try/catch" structure. What am I missing here? Update: It s C# ...
I need to be able to instantiate an object of a class in Dojo at runtime and mix it into another object (kind of like specifying an extends or an implements in Java, but at runtime). and I came up ...
I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...
File file = new File(path); if (!file.delete()) { throw new IOException( "Failed to delete the file because: " + getReasonForFileDeletionFailureInPlainEnglish(file)); } Is there a ...
I m looking for a way to continue execution of a transaction despite errors while inserting low-priority data. It seems like real nested transaction could be a solution, but they aren t supported by ...
I m trying to standardize the way I handle exceptions in my web application (homemade framework) but I m not certain of the "correct" way to handle various situations. I m wondering if there is a ...
I m having an issue with custom errors on an ASP.NET MVC app I ve deployed on my shared host. I ve created an ErrorController and added the following code to Global.asax to catch unhandled exceptions, ...