久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

RouteCollection.php 第 219 行中的 MethodNotAllowedHttpExc

MethodNotAllowedHttpException in RouteCollection.php line 219(RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException)
本文介紹了RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

當(dāng)我存儲(chǔ)帖子時(shí)出現(xiàn)此錯(cuò)誤

When I storing a post I get this error

MethodNotAllowedHttpException in RouteCollection.php line 219:

什么會(huì)導(dǎo)致這個(gè)問(wèn)題??

What can cause this problem ??

Routes.php:

Routes.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}', 'PostsController@show');
Route::get('posts/sukurti-nauja-straipsni', 'PostsController@create');
Route::patch('posts/store-new-post', 'PostsController@store');
Route::get('post/{slug}/{id}/edit', 'PostsController@edit');
Route::patch('posts/{slug}', 'PostsController@update');


Route::get('tags/{tags}', 'TagsController@show');
Route::get('categories/{categories}', 'CategoriesController@show');

// Authentication routes...
Route::get('auth/login', 'AuthAuthController@getLogin');
Route::post('auth/login', 'AuthAuthController@postLogin');
Route::get('auth/logout', 'AuthAuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'AuthAuthController@getRegister');
Route::post('auth/register', 'AuthAuthController@postRegister');

我正在使用 Laravel 5.1,但我一天都想不通..

I'm using Laravel 5.1 and I can't figure this out for a day..

推薦答案

由于您將帖子更新的方法設(shè)置為 patch,請(qǐng)確保您打開(kāi)您的表單以使用該方法:

Since you're setting the method on the post's update to be patch, be sure you open your form to use that method:

{!! Form::open(['method' => 'patch']) !!}

如果你沒(méi)有使用 Form 類,你也可以確保有一個(gè) 隱藏在表單下面的名為 _method 的元素:

If you're not using the Form class, you can also just ensure there's a hidden element called _method underneath the form:

<input name="_method" type="hidden" value="PATCH">

同樣,如果您通過(guò) AJAX 發(fā)送此數(shù)據(jù),只需在通過(guò) POST 發(fā)送請(qǐng)求之前將 _method 鍵添加到設(shè)置為 'PATCH' 的有效負(fù)載中.某些瀏覽器(IE 7/8)不支持通過(guò) XMLHttpRequest 的 PATCH HTTP

Similarly, if you're sending this data via AJAX, just add a _method key to the payload set to 'PATCH' before sending the request via POST. Some browsers (IE 7/8) do not support PATCH HTTP through XMLHttpRequest

您的另一個(gè)選擇是更改您的路由以接受 POST 數(shù)據(jù):

Your other option is to change your route to accept POST data instead:

Route::post('posts/store-new-post', 'PostsController@store');
Route::post('posts/{slug}', 'PostsController@update');

這篇關(guān)于RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Magento products by categories(按類別劃分的 Magento 產(chǎn)品)
Resource interpreted as image but transferred with MIME type text/html - Magento(資源被解釋為圖像但使用 MIME 類型 text/html 傳輸 - Magento)
Is there an event for customer account registration in Magento?(Magento 中是否有客戶帳戶注冊(cè)事件?)
Magento addFieldToFilter: Two fields, match as OR, not AND(Magento addFieldToFilter:兩個(gè)字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯(cuò)誤 404在 Magento 管理員登錄頁(yè)面)
Get Order Increment Id in Magento(在 Magento 中獲取訂單增量 ID)
主站蜘蛛池模板: 久久国内精品 | 91在线色视频| 天天爽天天操 | 在线观看www | 欧美综合在线观看 | 一级黄a视频 | 成人免费一区二区三区视频网站 | 日韩一区二区三区视频 | 精品国产三级 | 久国久产久精永久网页 | 国产精品欧美一区二区 | 成人在线观看免费爱爱 | www.xxxx欧美 | 欧美日韩高清在线一区 | 欧洲免费视频 | 欧美日韩精品一区二区三区四区 | 91看片在线观看 | 日本免费在线看 | 欧美日产国产成人免费图片 | 国产精品永久免费 | 国产精品日韩一区二区 | 一区二区三区在线电影 | 欧美精品一区二区三区在线播放 | 成人免费看电影 | 亚洲第一成年免费网站 | 九九久久国产精品 | 久久精品色欧美aⅴ一区二区 | 国产精品一区一区三区 | 国产精品伦一区二区三级视频 | 色综合色综合色综合 | 成人网在线观看 | 欧美一区二区三区久久精品视 | 婷婷色婷婷 | 亚洲午夜视频在线观看 | 久久综合九九 | 成人av电影天堂 | 国产一级免费视频 | 狠狠干天天干 | 91精品在线播放 | 久久精品久久久久久 | a级片在线观看 |