php – laravel-4:如何找到NotFoundHttpException的路由?

前端之家收集整理的这篇文章主要介绍了php – laravel-4:如何找到NotFoundHttpException的路由?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在日志中发现了NotFoundHttpException.看起来像这样:
[2013-11-26 13:49:20] log.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /var/www/myproject/vendor/laravel/framework/src/Illuminate/Routing/Router.PHP:1429
Stack trace:
#0 /var/www/myproject/vendor/laravel/framework/src/Illuminate/Routing/Router.PHP(1050): Illuminate\Routing\Router->handleRoutingException(Object(Symfony\Component\Routing\Exception\ResourceNotFoundException))
#1 /var/www/myproject/vendor/laravel/framework/src/Illuminate/Routing/Router.PHP(1014): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
#2 /var/www/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.PHP(530): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#3 /var/www/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.PHP(506): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#4 /var/www/myproject/public/index.PHP(49): Illuminate\Foundation\Application->run()
#5 {main} [] []

这告诉你什么也不是浪费磁盘空间.

如何找到导致NotFoundHttpException的URI?

在app / start / global.PHP中扩展App :: error():
App::error(function(Exception $exception,$code)
{
    if ($exception instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException)
    {
        Log::error('NotFoundHttpException Route: ' . Request::url() );
    }

    Log::error($exception);
});

现在你得到一个附加的日志条目与URL:

[2013-11-26 14:20:07] log.ERROR: NotFoundHttpException Route: http://myproject.net/asdfgsdfghsdfg [] []
原文链接:https://www.f2er.com/laravel/140009.html

猜你在找的Laravel相关文章