thinkPHP5.0 URL重写文档https://www.kancloud.cn/manual/thinkphp5/177576
postman下载地址https://www.postman.com/downloads/
官方的Apache伪静态
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
可以看到index.php?
后面少了一个s=
,但是官方的Nginx伪静态中是有s=
的,上面这个伪静态平时没有影响,但是获取所有参数会多出来一个参数,如下图
但是用下面的伪静态却没有问题,如下图
<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
class Index extends Controller
{
public function test()
{
dump(input());
}
}
?>
Apache伪静态
这个伪静态参考了宝塔的Apache thinkPHP伪静态
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>
Nginx伪静态
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}