草庐IT

MethodNotAllowedHttpException

全部标签

php - Laravel 4.2 MethodNotAllowedHttpException 删除

我是Laravel的新手,所以有一个项目,一个简单的CRUD,但是当我尝试删除数据时delete方法不起作用,我真的不知道为什么。这是错误:错误:thrownewMethodNotAllowedHttpException($others);Controller:publicfunctiondestroy($id){$project=Project::find($id);if($project->user_id==Auth::id()){$project->delete();returnRedirect::to('/');}else{Session::flash('message','Y

php - 在 Laravel 表单中使用 PUT 和 DELETE 方法时出现 MethodNotAllowedHttpException

我正在使用Laravel进行基本的CRUD。在Laravel表单操作中使用PUT和DELETE方法时出现MethodNotAllowedHttpException。GET和POST操作方法工作正常。 最佳答案 HTML表单只接受GET或POST方法所以你不能使用PUT和DELETE在形式方法中。但是,如果您想使用PUT或DELETE然后laravel提供Formmethodspoofing像这样这是表单示例简写@method('PUT')@csrf路线Route::put('foo/bar','FooController@bar')

php - 带 Dingo 的 Laravel 5 API

我正在使用Laravel5和Dingo构建API。我如何捕获任何没有定义路由的请求?我希望我的API始终以特定格式的JSON响应进行响应。例如,如果我有一条路线:$api->get('somepage','mycontroller@mymethod');如果有人在假设未定义路由的情况下向同一uri创建帖子,我该如何处理?本质上,Laravel正在抛出MethodNotAllowedHttpException。我试过这个:Route::any('/{all}',function($all){$errorResponse=['Message'=>'Error','Error'=>['dat

php - 在 laravel 中更新记录时出现 MethodNotAllowedHttpException

我最近加入了Laravel框架,所以首先我尝试在Laravel中制作一个CRUD系统,以了解它们的基本原理和功能。现在我在更新现有记录时遇到错误MethodNotAllowedHttpException。在我的routeRoute::resource('product','ProductController');这给了我以下可能的路线列表|GET|HEAD|product|product.index|App\Http\Controllers\ProductController@index|POST|product|product.store|App\Http\Controllers\P

php - 拉维尔 : POST method returns MethodNotAllowedHttpException

我的api.php文件中有一个POST路由,它是这样的:Route::group(['namespace'=>'api'],function(){Route::post('parent/signup','ParentController@signUp');});我正尝试在postman中访问此url,因为这是一个api路由。但是当我向这个route发送请求时,这个exception发生了:MethodNotAllowedHttpExceptioninRouteCollection.phpline218:我肯定会发送一个帖子请求,如下图所示:我运行了phpartisanroute:lis

php - 实时服务器上的 Symfony2 MethodNotAllowedHttpException

我在实时服务器上遇到以下错误:request.ERROR:UncaughtPHPExceptionSymfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException:"Noroutefoundfor"GETuser/create:MethodNotAllowed(Allow:POST)"at/home/public_html/project/app/cache/prod/classes.phpline3685但我在具有相同代码的本地计算机上没有收到此错误。解决方案指向清除缓存,但我不知道如何清除实时服务器上的缓存。我

php - MethodNotAllowedHttpException laravel-4

表格:{{Form::open(array('url'=>'user/create','files'=>true))}}路线:Route::resource('user','UserController');用户Controller.phpclassUserControllerextendsBaseController{publicfunctionindex(){return'hi11';//returnView::make('home.index');}publicfunctioncreate(){return'hi22';//returnView::make('home.index

php - Laravel 5 MethodNotAllowedHttpException 在 RouteCollection.php 行 201 :

我的项目中有很多php文件:admin.blade.php:此文件包含管理表单。调用时显示以下错误:MethodNotAllowedHttpExceptioninRouteCollection.phpline201PleaseLogInToManage">UserName:Password:在route.php中,调用如下:Route::get('/admin',array('uses'=>'student@admin'));这是student.php中的函数publicfunctionadmin(){returnView::make('student.admin');$validat

php - Laravel 5 - 我如何处理 MethodNotAllowedHttpException

在Laravel5+中,我在哪里可以捕获MethodNotAllowedHttpException?在Laravel4中,我可以在start/global.php中执行此操作。 最佳答案 //Exceptions/Handler.phpuseSymfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;publicfunctionrender($request,\Exception$e){if($einstanceofMethodNotAllowedHttp

php - RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException

当我存储帖子时出现此错误MethodNotAllowedHttpExceptioninRouteCollection.phpline219:什么会导致这个问题??路由.php:Route::get('home','PostsController@index');Route::get('/','PostsController@index');Route::get('index','PostsController@index');Route::get('posts','PostsController@index');Route::get('post/{slug}/{id}','PostsC
12