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

RouteCollection.php 第 219 行中的 MethodNotAllowedHttpExc

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

問題描述

當(dāng)我存儲帖子時出現(xiàn)此錯誤

When I storing a post I get this error

MethodNotAllowedHttpException in RouteCollection.php line 219:

什么會導(dǎo)致這個問題??

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,請確保您打開您的表單以使用該方法:

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']) !!}

如果你沒有使用 Form 類,你也可以確保有一個 隱藏在表單下面的名為 _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">

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

您的另一個選擇是更改您的路由以接受 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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 中是否有客戶帳戶注冊事件?)
Magento addFieldToFilter: Two fields, match as OR, not AND(Magento addFieldToFilter:兩個字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯誤 404在 Magento 管理員登錄頁面)
Get Order Increment Id in Magento(在 Magento 中獲取訂單增量 ID)
主站蜘蛛池模板: 久久久久国产一区二区三区 | 亚洲国产精品日韩av不卡在线 | 999国产精品视频免费 | 二区视频| 天天干天天爱天天操 | 欧美日韩亚洲国产 | 亚洲高清一区二区三区 | 日本又色又爽又黄又高潮 | 久久精品国产99国产精品 | 欧美精品在线一区二区三区 | 欧美福利影院 | 精品91 | 欧美视频一区二区三区 | 国产区在线观看 | 日本成人免费观看 | 蜜桃视频一区二区三区 | 一区免费视频 | 国产精品成人一区二区三区吃奶 | 精品欧美一区二区三区 | 日本三级电影免费 | 在线观看国产wwwa级羞羞视频 | 精品国产91亚洲一区二区三区www | 精品欧美一区二区三区久久久 | 视频在线一区二区 | 国产一区二区三区免费观看视频 | 中文字幕日韩三级 | 国产成人精品久久二区二区91 | 日韩国产欧美 | 久久另类视频 | 免费一区二区三区 | 中文字幕国产精品 | 国产精品视频区 | 97精品一区二区 | 久久精品无码一区二区三区 | 国产视频2021 | 亚洲国产精品一区二区第一页 | 国产一区二区三区久久 | 中文字幕第三页 | 精品欧美在线观看 | 久久久青草婷婷精品综合日韩 | 久久久久国产精品一区二区 |