<tfoot id='s418s'></tfoot>
    1. <i id='s418s'><tr id='s418s'><dt id='s418s'><q id='s418s'><span id='s418s'><b id='s418s'><form id='s418s'><ins id='s418s'></ins><ul id='s418s'></ul><sub id='s418s'></sub></form><legend id='s418s'></legend><bdo id='s418s'><pre id='s418s'><center id='s418s'></center></pre></bdo></b><th id='s418s'></th></span></q></dt></tr></i><div id='s418s'><tfoot id='s418s'></tfoot><dl id='s418s'><fieldset id='s418s'></fieldset></dl></div>
      • <bdo id='s418s'></bdo><ul id='s418s'></ul>

      <legend id='s418s'><style id='s418s'><dir id='s418s'><q id='s418s'></q></dir></style></legend>

      <small id='s418s'></small><noframes id='s418s'>

        Laravel 4 异常:NotFoundHttpException

        Laravel 4 Exception: NotFoundHttpException(Laravel 4 异常:NotFoundHttpException)
      1. <legend id='WsvtU'><style id='WsvtU'><dir id='WsvtU'><q id='WsvtU'></q></dir></style></legend>

          1. <tfoot id='WsvtU'></tfoot>

            <i id='WsvtU'><tr id='WsvtU'><dt id='WsvtU'><q id='WsvtU'><span id='WsvtU'><b id='WsvtU'><form id='WsvtU'><ins id='WsvtU'></ins><ul id='WsvtU'></ul><sub id='WsvtU'></sub></form><legend id='WsvtU'></legend><bdo id='WsvtU'><pre id='WsvtU'><center id='WsvtU'></center></pre></bdo></b><th id='WsvtU'></th></span></q></dt></tr></i><div id='WsvtU'><tfoot id='WsvtU'></tfoot><dl id='WsvtU'><fieldset id='WsvtU'></fieldset></dl></div>

            <small id='WsvtU'></small><noframes id='WsvtU'>

              <tbody id='WsvtU'></tbody>
                <bdo id='WsvtU'></bdo><ul id='WsvtU'></ul>
                  本文介绍了Laravel 4 异常:NotFoundHttpException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的 Laravel 4 应用程序的日志有时会显示 NotFoundHttpException:

                  My Laravel 4 application's logs sometimes show a NotFoundHttpException:

                  exception 'SymfonyComponentHttpKernelExceptionNotFoundHttpException' in /var/www/laravel4/bootstrap/compiled.php:7420
                  Stack trace:
                  #0 /var/www/laravel4/bootstrap/compiled.php(7137): IlluminateRoutingRouter->handleRoutingException(Object(SymfonyComponentRoutingExceptionResourceNotFoundException))
                  #1 /var/www/laravel4/bootstrap/compiled.php(7113): IlluminateRoutingRouter->findRoute(Object(IlluminateHttpRequest))
                  #2 /var/www/laravel4/bootstrap/compiled.php(958): IlluminateRoutingRouter->dispatch(Object(IlluminateHttpRequest))
                  #3 /var/www/laravel4/bootstrap/compiled.php(946): IlluminateFoundationApplication->dispatch(Object(IlluminateHttpRequest))
                  #4 /var/www/laravel4/public/index.php(49): IlluminateFoundationApplication->run()
                  #5 {main}
                  

                  是什么原因造成的?堆栈跟踪没有显示我的代码中的任何内容.

                  What could have caused this? The stack trace doesn't show anything from my code.

                  推荐答案

                  NotFoundHttpException 基本上只是应用程序中的 404.不幸的是,异常消息甚至没有告诉您触发异常的请求的 URL,这使得当您在日志中看到这些错误时很难理解它们.

                  A NotFoundHttpException is basically just a 404 in your application. Unfortunately the exception message doesn't even tell you the URL of the request that triggered the exception, which makes it difficult to understand these errors when you see them in your logs.

                  要为您提供更多调试信息,请设置您自己的 404 处理程序.这是一个简单的处理程序,它将记录 URL(因此您知道触发错误的请求)和用户代理(帮助您确定是谁或什么发出了请求)并返回一个视图和 404 代码:

                  To give you more debugging information, set up your own 404 handler. Here's a simple handler which will log the URL (so you know what was requested to trigger the error) and the user agent (to help you figure out who or what made the request) and return a view and 404 code:

                  App::missing(function($e) {
                      $url = Request::fullUrl();
                      $userAgent = Request::header('user-agent');
                      Log::warning("404 for URL: $url requested by user agent: $userAgent");
                      return Response::view('errors.not-found', array(), 404);
                  });
                  

                  把它放在app/start/global.php中.

                  这篇关于Laravel 4 异常:NotFoundHttpException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Laravel 4 - Connect to other database(Laravel 4 - 连接到其他数据库)
                  Call external API function from controller, LARAVEL 4(从控制器调用外部 API 函数,LARAVEL 4)
                  Empty string instead of null values Eloquent(空字符串而不是空值 Eloquent)
                  quot;laravel.logquot; could not be opened: failed to open stream(“laravel.log无法打开:无法打开流)
                  Displaying the Error Messages in Laravel after being Redirected from controller(从控制器重定向后在 Laravel 中显示错误消息)
                  Laravel Creating Dynamic Routes to controllers from Mysql database(Laravel 从 Mysql 数据库创建到控制器的动态路由)
                    <bdo id='opMHa'></bdo><ul id='opMHa'></ul>
                  • <small id='opMHa'></small><noframes id='opMHa'>

                      <tbody id='opMHa'></tbody>
                  • <tfoot id='opMHa'></tfoot>
                    <legend id='opMHa'><style id='opMHa'><dir id='opMHa'><q id='opMHa'></q></dir></style></legend>

                    <i id='opMHa'><tr id='opMHa'><dt id='opMHa'><q id='opMHa'><span id='opMHa'><b id='opMHa'><form id='opMHa'><ins id='opMHa'></ins><ul id='opMHa'></ul><sub id='opMHa'></sub></form><legend id='opMHa'></legend><bdo id='opMHa'><pre id='opMHa'><center id='opMHa'></center></pre></bdo></b><th id='opMHa'></th></span></q></dt></tr></i><div id='opMHa'><tfoot id='opMHa'></tfoot><dl id='opMHa'><fieldset id='opMHa'></fieldset></dl></div>