我今天安装了 laravel 7.0 的新副本,我正在使用以下路由和控制器
路线
Route::get('/','DashboardController@dashboard');
Route::get('dashboard2','DashboardController@dashboard2');
Route::get('dashboard3','DashboardController@dashboard3');
仪表板控制器
class DashboardController extends Controller
{
public function dashboard(){
return view('dashboard.index');
}
public function dashboard2(){
return view('dashboard.index2');
}
public function dashboard3(){
return view('dashboard.index3');
}
}
所有这些路由都返回 404 not found 除了这些Route::get('/','DashboardController@dashboard');
在这里我发现具有'/'
url 的路由只能正常工作,因为如果我将dashboard2
url 更改为'/'
它也可以工作,
其他路线也通过php artisan serve
命令在 Laravel 开发服务器上工作。但是我不习惯这样做,有什么解决办法吗?
路线清单
+--------+----------+------------+------+-----------------------------------------------------+---------
---+
| | GET|HEAD | | | App\Http\Controllers\DashboardController@dashboard | web
|
| | GET|HEAD | dashboard2 | | App\Http\Controllers\DashboardController@dashboard2 | web
|
| | GET|HEAD | dashboard3 | | App\Http\Controllers\DashboardController@dashboard3 | web
|
+--------+----------+------------+------+-----------------------------------------------------+---------
---+
我已经清除了所有缓存,如路由、视图、配置等