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

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

WBOY
WBOYOriginal
2016-06-23 13:59:101003browse

如果,如何最简单的获取当前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";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