在 Laravel 4 中,很容易抑制 E_NOTICE 消息;我似乎无法做到这一点,因为如果我添加
In Laravel 4, it was easy enough to suppress E_NOTICE messages; I can't seem to be able to do this because if I add
error_reporting(E_ALL ^ E_NOTICE)
在任何地方它都会被覆盖.
anywhere it simply gets overridden.
这似乎发生在这里:(index.php)
This seems to happen around here: (index.php)
$response = $kernel->handle(
$request = IlluminateHttpRequest::capture()
);
我在 Exceptions/Handler.php 中添加了自定义代码来处理更多漂亮"的异常/错误视图,但我正在努力关闭通知(我根本不希望这些中的任何一个被通知触发)
I have added custom code to handle more "pretty" views of exceptions/errors within Exceptions/Handler.php but I'm struggling to switch off notices (I don't want any of these firing off with notices at all)
在 Laravel 5 中,我们可以在 AppServiceProviders::boot
里面设置 error_reporting(E_ALL ^ E_NOTICE)
方法:
In Laravel 5, we can set error_reporting(E_ALL ^ E_NOTICE)
inside the AppServiceProviders::boot
method:
public function boot()
{
//set whatever level you want
error_reporting(E_ALL ^ E_NOTICE);
}
这篇关于Laravel 5 错误报告抑制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!