Laravel 路由匹配所有请求

动态匹配所有

Route::group([], function () {
    Route::any('/{controller?}/{action?}', function($controller='', $action=''){
        if (empty($controller)) {
            return 'welcome!';
        }else {
            $controller = "App\\Http\\Controllers\\".ucfirst($controller).'Controller';
            return App::make($controller)->$action();
        }
    });
});

你可能感兴趣的:(Laravel 路由匹配所有请求)