Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php POST路由,调用GET时生成MethodNotAllowedHttpException_Php_Laravel_Laravel 4_Laravel Routing - Fatal编程技术网

Php POST路由,调用GET时生成MethodNotAllowedHttpException

Php POST路由,调用GET时生成MethodNotAllowedHttpException,php,laravel,laravel-4,laravel-routing,Php,Laravel,Laravel 4,Laravel Routing,我宣布了一条邮政路线: Route::post('sessions', [ 'as' => 'sessions.store', 'uses' => 'UserAuthenticationController@store' ]); 当我访问www.domainname.com/sessions时,它会生成MethodNotAllowedHttpException 我正在尝试使用以下方法处理所有丢失的路线: /global.php/ App::missing(function($exc

我宣布了一条邮政路线:

Route::post('sessions', [
'as' => 'sessions.store',
'uses' => 'UserAuthenticationController@store'
]);
当我访问www.domainname.com/sessions时,它会生成MethodNotAllowedHttpException

我正在尝试使用以下方法处理所有丢失的路线:

/global.php/

App::missing(function($exception) {
return View::make('exceptions.404');
});
当我没有为(会话)声明任何GET路由时,我无法理解为什么会生成此异常


感谢您,因为您的应用程序中有
debug=true


当您的应用程序调试设置为
false
,它将显示404页面。

也许您的问题出在控制器上

class UserAuthenticationController extends Controller
{

public function store()
{
return View::make('sessions.store');
}

}
只是别忘了它只在你发帖的时候起作用;你也可以使用

Route::any('sessions', [
'as' => 'sessions.store',
'uses' => 'UserAuthenticationController@store'
]);
确保在sessions文件夹的视图中,stroe文件名正确,如

store.blade.php


如果我调用另一个未声明的路由,它会将我发送到404页,我认为它不会经历那个错误,因为DEBUG=true。虽然我还没有声明GET路由,但它应该由APP::missing进行铸造