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

相关文章:

  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-09-26
  • 2021-08-02
猜你喜欢
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2021-06-07
  • 2021-08-01
相关资源
相似解决方案