https://www.jianshu.com/p/c43fb5817ae1
TP5的url方法生成的是閹割版pathinfo 也就是上面說的第二種。
在config.php第一行加上
\think\Url::root('index.php?s=');
之后就生成的URL是第二種模式。
$request = Request::instance();
echo "當前模塊名稱是" . $request->module();
echo "當前控制器名稱是" . $request->controller();
echo "當前操作名稱是" . $request->action();
echo "<Br>";
echo url("HelloWorld/index",'id=5&name=thinkphp').'<br>';
echo url('HelloWorld/index?id=5&name=thinkphp').'<br>';
輸出
當前模塊名稱是index當前控制器名稱是HelloWorld當前操作名稱是index
index.php?s=/index/hello_world/index/id/5/name/thinkphp
index.php?s=/index/hello_world/index/id/5/name/thinkphp