我有一个.htacess文件,如;
RewriteRule ^(.*)$ index.php/$1 [NC,QSA,L]
让我说我有一个网址:www.example.com/index/action
。 当我的index.php打印$_SERVER['PATH_INFO']
我看到/action
但如果我的网址就像是www.example.com/index1/action
,我可以看到/index1/action
,但我想看看在这两个案例的完整路径。我该如何解决它?
我有一个.htacess文件,如;
RewriteRule ^(.*)$ index.php/$1 [NC,QSA,L]
让我说我有一个网址:www.example.com/index/action
。 当我的index.php打印$_SERVER['PATH_INFO']
我看到/action
但如果我的网址就像是www.example.com/index1/action
,我可以看到/index1/action
,但我想看看在这两个案例的完整路径。我该如何解决它?
如果你想看到它的URL重写之前,我相信你正在寻找:
$_SERVER['REQUEST_URI']
你可能会寻找$_SERVER['PHP_SELF']
。
对于www.example.com/index/action
,你会得到/index.php/index/action
为www.example.com/index1/action
,你会得到/index.php/index1/action
尝试$_SERVER['REQUEST_URI']
的代码这是很有帮助的位将插入页面的地址,用户当前因此,如果您使用“http://test.com/pages/test/”,代码将复制“/ pages/test /”。要在代码中使用它: