后来想到了用多入口的方式,网站展示用index.php入口,网站后台用admin.php入口。代码如下。
namespace think;
require __DIR__ . '/../vendor/autoload.php';
// 执行HTTP应用并响应
$http = (new App())->http;
$response = $http->name('admin')->run();
$response->send();
$http->end($response);然后在伪静态那里设置以下,我用的是nginx。location / {
if (!-e $request_filename){
rewrite ^/admin(.*)$ /admin.php?s=$1 last;
rewrite ^/index(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
这样以来,就解决了网站url中必须包含index的问题,可以用路由任意配置了。
网站叫土壤肥料养分检测仪https://www.trsq17.com/
最佳答案