首页 > 解决方案 > 路线 404 错误 Laravel

问题描述

我遇到了一个我不太明白的错误。该路线似乎在我的开发机器(Windows 10、php 7)上运行良好,但在共享 linux 主机上出现 404 错误。

下面是代码:

路线

 Auth::routes();
Route::get('/curries','CurriessController@index')->name('curries');
Route::resource('/curries','CurriesController');

链接

 <td><a href="/curries/{{$curry->id}}"> {{$curry->curry_title}}</a></td>

我也试过route('curry.index', $curry->id

对我来说没有意义的是它可以在 Windows 上运行,但 404 在 linux 上运行。请协助

标签: phplaravelroutes

解决方案


  1. Make sure the Model exists
  2. Make sure the table exists in the database
  3. replace your link with <td><a href="{{route('curries.index')}}/{{$curry->id}}">Type of Curry</a></td>

This should work


推荐阅读