版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/itxiaolong3/article/details/84671771
问题1:项目放置到服务器后出现路由失效问题。
解决:在宝塔中的伪静态设置里设置
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
没使用宝塔的就在Nginx.conf添加此设置
问题2.如何给地址添加index.php
解决:在指定的控制器中加入
Url::root('/yikehao/index.php');
记得引入 use think\Url;