Lumen 在 RoutesRequests.php 中给出 NotFoundHttpException 而没有 public/index.php
Lumen gives NotFoundHttpException in RoutesRequests.php without public/index.php
在没有 public/index.php.
的情况下访问时,我服务器中的 Lumen 安装出现 NotFoundHttpException
Apache 配置:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/myapi/public
<Directory /var/www/html/myapi>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
.htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
目录结构:
> var/www/html
> ------------/myapi/ (lumen application)
> ------------/myapi/public/
index.php 在 var/www/html/myapi/public
$app->run($app->make('request'));
NotFoundHttpException:
- 在 RoutesRequests.php 第 461 行
- 在 RoutesRequests.php 第 398 行
中的 Application->handleDispatcherResponse(array('0'))
- 在 Application->Laravel\Lumen\Concerns{closure}() 在 RoutesRequests.php 行 650
- 在 RoutesRequests.php 第 400 行
中的 Application->sendThroughPipeline(array(), object(Closure))
- 在 RoutesRequests.php 第 341 行
中的 Application->dispatch(object(Request))
- at Application->运行(object(Request)) in index.php line 30
NotFoundHttpException 当您的请求未在 route.php
中列出时给出
$app->get('request', function() {
return view('your view file');
});
问题已通过更改
解决
$app->run();
在/public/index.php
到
$request = Illuminate\Http\Request::capture();
$app->run($request);
在没有 public/index.php.
的情况下访问时,我服务器中的 Lumen 安装出现 NotFoundHttpExceptionApache 配置:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/myapi/public
<Directory /var/www/html/myapi>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
.htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
目录结构:
> var/www/html
> ------------/myapi/ (lumen application)
> ------------/myapi/public/
index.php 在 var/www/html/myapi/public
$app->run($app->make('request'));
NotFoundHttpException:
- 在 RoutesRequests.php 第 461 行
- 在 RoutesRequests.php 第 398 行 中的 Application->handleDispatcherResponse(array('0'))
- 在 Application->Laravel\Lumen\Concerns{closure}() 在 RoutesRequests.php 行 650
- 在 RoutesRequests.php 第 400 行 中的 Application->sendThroughPipeline(array(), object(Closure))
- 在 RoutesRequests.php 第 341 行 中的 Application->dispatch(object(Request))
- at Application->运行(object(Request)) in index.php line 30
NotFoundHttpException 当您的请求未在 route.php
中列出时给出
$app->get('request', function() {
return view('your view file');
});
问题已通过更改
解决$app->run();
在/public/index.php
到
$request = Illuminate\Http\Request::capture();
$app->run($request);