laravel 路由

话不多说,先看代码

Route::any("index/{action?}", function (App\Http\Controllers\Admin\indexController $index, $action = 'index') {
    return $index->$action();
});

意思是   访问index 控制器 下的方法,,如果控制器中有方法,则访问在地址栏中输入的方法,如果不输入,则默认访问index 方法

(这时候有人就会问为什么会访问index 呢   答案在下一章)

猜你喜欢

转载自blog.csdn.net/qq_42217190/article/details/81103263