Laravel 404错误无法正常工作

时间:2014-12-22 14:29:49

标签: php laravel-4 http-status-code-404 wamp

我正在为我的laravel网站设置一个404页面;对于我一直在阅读的内容,我应该添加

App::missing(function($exception)
{
    return Response::view('error.missing', array(), 404);
});

到app / start / global.php文件。但问题是,只要我将其添加到文件中并且我转到一条不会激动的路由,我会收到以下消息:异常处理程序出错。

我在视图中添加了一个地图错误,并在那里创建了一个视图missing.blade.php!

我一直在尝试很多东西,但到目前为止还无法解决问题。

Atm我在WAMP上运行该项目。

希望有人可以帮我解决这个问题! :)

我的laravel记录的内容:

> [2014-12-22 15:10:54] production.ERROR: exception
> 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in
> C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php:5687
> Stack trace:
> #0 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(5004):
> Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))
> #1 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(4992):
> Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
> #2 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(4984):
> Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
> #3 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(717):
> Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
> #4 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(698):
> Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
> #5 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(7706):
> Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request),
> 1, true)
> #6 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(8309):
> Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request),
> 1, true)
> #7 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(8256):
> Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1,
> true)
> #8 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(10895):
> Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1,
> true)
> #9 C:\Users\Sam\Dropbox\Web Projects\Petere\bootstrap\compiled.php(659):
> Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
> #10 C:\Users\Sam\Dropbox\Web Projects\Petere\public\index.php(49): Illuminate\Foundation\Application->run()
> #11 {main} [] []

1 个答案:

答案 0 :(得分:0)

只需在您的观看404.blade.php中添加resources/views/error/404.blade.php,就会像我所做的一样。