作曲家更新后,主路由(/)在實時服務器中不起作用
它顯示:不允許使用的方法 這個URL不允許使用請求的GET方法。
另外,在試圖使用ErrorDocument來處理請求時,遇到了405方法不允許的錯誤。
Route。 Route::post('/', [WebController::class, 'index']);
除了這個之外,所有的路由都能在實時服務器上作業
uj5u.com熱心網友回復:請將post改為get
Route: Route::post('/', [WebController::class, 'index'])。)
to
Route: Route::get('/', [WebController::class, 'index'])。)
你的錯誤是HTTP請求方法
uj5u.com熱心網友回復:
你應該對GET請求使用index方法,對POST請求使用Store方法,對PUT請求使用Update方法,對DELETE使用destroy方法。
你通常可以使用下面的方法,
你可以使用下面的方法。
Route::resource('/', WebController::class); //資源路由
這樣就可以避免為每個請求提及方法名稱。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/321591.html
標籤:
