laravel form post issue

后端 未结 7 1295
旧时难觅i
旧时难觅i 2021-01-05 19:04

I am building a practice app with the Laravel framework I built a form in one of the views which is set to post to the same view itself but when I hit

7条回答
  •  孤街浪徒
    2021-01-05 19:44

    The problem is with defualt slashed in Apache from 2.0.51 and heigher: http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryslash

    The best solution if you do not want to change Apache config is to make the post in a different path:

    GOOD:

    Route::get('/', 
      ['as' => 'wizard', 'uses' => 'WizardController@create']);
    
    Route::post('wizard-post', 
      ['as' => 'wizard_store', 'uses' => 'WizardController@store']);
    

    NOT GOOD:

    Route::get('/', 
      ['as' => 'wizard', 'uses' => 'WizardController@create']);
    
    Route::post('/', 
      ['as' => 'wizard_store', 'uses' => 'WizardController@store']);
    

提交回复
热议问题