1.在public下建2个入口文件,分别是
admin.php 代表后台
index.php 代表前台
2.在route文件下,分别建前后台的路由文件
admin/app.php
<?php
use think\facade\Route;
Route::get('admin/', 'index/index');
Route::get('admin/weclome', 'index/weclome')->name('weclome');
index/route.php
<?php
use think\facade\Route;
Route::get('', 'index/index');
Route::get('hello', 'index/hello');
3.public 目录下的.htaccess文件里如下图这样写
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin(.*)$ admin.php [L,E=PATH_INFO:$1]
RewriteRule !^index(.*)$ index.php/index/ [L,E=PATH_INFO:$1]
</IfModule>
到这里多入口应用入口文件就隐藏了,试试吧