刚刚安装了Lumen并得到了NotFoundHttpException

rob*_*san 14 php laravel lumen lumen-5.2 lumen-routing

我正在寻找解决方案...它变得非常令人沮丧.在Laravel彻底安装Lumen之后,我根本无法访问"/"路线.当我尝试时,它会抛出一个错误:

NotFoundHttpException in RoutesRequests.php line 443:

in RoutesRequests.php line 443
at Application->handleDispatcherResponse(array('0')) in RoutesRequests.php line 380
at Application->Laravel\Lumen\Concerns\{closure}() in RoutesRequests.php line 629
at Application->sendThroughPipeline(array(), object(Closure)) in RoutesRequests.php line 382
at Application->dispatch(null) in RoutesRequests.php line 327
at Application->run() in index.php line 28
Run Code Online (Sandbox Code Playgroud)

rob*_*san 63

得到它了!....

解决方案是在第28行更改public/index.php:

$app->run();
Run Code Online (Sandbox Code Playgroud)

$app->run($app->make('request'));
Run Code Online (Sandbox Code Playgroud)

不知道为什么,也许你知道.

  • 这解决了我在尝试将Laravel 5应用程序部署到生产环境时遇到的类似问题.我也很想知道为什么会这样. (3认同)
  • 仅此行写为Lumen(5.5.2)(Laravel Components 5.5。*)对我不起作用 (2认同)