9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Laravel]POST通信が上手くいかない場合に確認すること

Posted at

POSTが上手くいかなかったのでその時に確認事項を覚書

こうゆうルーティングを書いた

Route::group(['prefix' => 'search'], function()
{
    Route::post('/', 'SearchController@postSearch');
});

そしてこうゆうform書いた

<form acton="http://xxxx.com/search/" method="post">
{{ csrf_field() }}

submitした。
ダメでした。。。

解決

<form acton="http://xxxx.com/search" method="post">
{{ csrf_field() }}

URLの最後に「/」があるとPOST後に「301」でGETリダイレクトされる。
そういう仕様なのでしょうかね?
とりあえず覚書。

9
6
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?