ThinkPHP5最新URL訪問:PATH_INFO和兼容模式

https://www.jianshu.com/p/c43fb5817ae1php

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當前操做名稱是indexindex.php?s=/index/hello_world/index/id/5/name/thinkphpindex.php?s=/index/hello_world/index/id/5/name/thinkphp
相關文章
相關標籤/搜索