Home >php教程 >PHP源码 >获取地址栏传递的参数

获取地址栏传递的参数

PHP中文网
PHP中文网Original
2016-05-23 16:40:211313browse

获取地址栏传递的参数

<?php
	/*
	*
	*地址栏参数获取类函数
	*/
function getUrl(){
   $url = parse_url($_SERVER[&#39;REQUEST_URI&#39;]);
   parse_str($url[&#39;query&#39;],$queryArr); 
   unset($queryArr[&#39;page&#39;]);
   $queryStr = http_build_query($queryArr);				
   //将获取的地址数组重新组合成一个新的地址栏
   echo $url[&#39;path&#39;].&#39;?&#39;.$queryStr.&#39;&page=&#39;;
} 
?>

 以上就是获取地址栏传递的参数的内容,更多相关内容请关注PHP中文网(www.php.cn)!


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