https://www.jianshu.com/p/c43fb5817ae1
http://tp5.com/index.php?s=USER/manger_user/add&n=2000&m=500 (典型兼容模式)
http://tp5.com/index.php?s=user/manger_user/add/n/20/m/500 (PATH_INFO方式)
http://tp5.com/index.php/user/manger_user/add/n/20/m/5000 (PATH_INFO方式)
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 "
";
echo url("HelloWorld/index",'id=5&name=thinkphp').'
';
echo url('HelloWorld/index?id=5&name=thinkphp').'
';
输出
当前模块名称是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
标签:INFO,index,name,URL,ThinkPHP5,echo,user,php,id
来源: https://www.cnblogs.com/as3lib/p/10956090.html