// +---------------------------------------------------------------------- use think\facade\Route; Route::rule('/', 'Front.Index/index'); Route::rule('search', 'Front.Content/search'); Route::rule('lists', 'Front.Content/lists'); Route::rule('detail-:id', 'Front.Content/detail'); Route::rule('category', 'Front.Content/category'); Route::rule('topic-:id', 'Front.Content/topic'); Route::rule('form/:id/:name', 'Front.Form/index'); Route::rule('front/:controller/:function', 'Front.:controller/:function'); Route::group('admin', function () { Route::rule('/', 'admin.Index/index'); Route::rule('login', 'admin.Index/login'); Route::rule('logout', 'admin.Index/logout'); Route::rule('upload/:function', 'Upload/:function'); Route::rule(':controller/:function', 'admin.:controller/:function'); }); Route::group('user', function () { Route::rule('/', 'user.Index/index'); Route::rule('login', 'user.Index/login'); Route::rule('logout', 'user.Index/logout'); Route::rule('register', 'user.Index/register'); Route::rule('upload/:function', 'Upload/:function'); Route::rule(':controller/:function', 'user.:controller/:function'); }); Route::group('api', function () { Route::rule('/', 'api.Index/index'); Route::rule('login', 'api.Login/index'); Route::rule('register', 'api.Login/register'); Route::rule('logout', 'api.Login/logout'); Route::rule(':controller/:function', 'api.:controller/:function'); })->allowCrossDomain([ 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Headers' => 'authorization, token, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With', ]); Route::miss('Index/miss');