ThinkPHP隐藏index.php的两种方式

463 阅读1分钟

第一种:使用测试端口

进入命令行下面,执行下面指令

php think run

在浏览器中输入地址:

http://localhost:8000/

第二种:nginx文件配置

在ThinkPHP的public目录下配置nginx.htaccess文件,添加代码:

location / {
   if (!-f $request_filename) {
   		rewrite  ^(.*)$  /index.php?s=/$1  last;
    }
}

注意:ThinkPHP6.0文档中带有“//省略部分代码”表述,要删除“//”及后面的注释。