Home  >  Article  >  Backend Development  >  PHP怎么简单快速获取当前URL地址(包括后面参数)

PHP怎么简单快速获取当前URL地址(包括后面参数)

WBOY
WBOYOriginal
2016-06-13 11:54:361539browse

PHP如何简单快速获取当前URL地址(包括后面参数)
如果,如何最简单的获取当前URL的地址,不包括域名,但包括后面的参数。

如:http://127.0.0.1/index.php?r=admin/index/index&type=aa

这样的一个地址,我想获取/index.php?r=admin/index/index&type=aa这一部分。

PHP怎么写?
------解决方案--------------------

$uri = "http://127.0.0.1/index.php?r=admin/index/index&type=aa";<br />var_dump ( parse_url ( $uri ));

------解决方案--------------------
$_SERVER['REQUEST_URI']

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn