Home >Backend Development >PHP Tutorial >怎么获取‘/’后面的参数

怎么获取‘/’后面的参数

WBOY
WBOYOriginal
2016-06-13 11:06:511351browse

如何获取‘/’后面的参数?
看拍拍商品url:‘/’后面是商品参数,如何获取?js、php均可,谢谢
http://auction1.paipai.com/2A8B5E1F00000000002A3AD20787D992?PTAG=40042.2.7
------解决方案--------------------

<br />$_SERVER['QUERY_STRING']; //获取参数<br />$_SERVER['PHP_SELF'];  //获取网址<br />

------解决方案--------------------

引用:
PHP code?123$_SERVER['QUERY_STRING']; //获取参数$_SERVER['PHP_SELF'];  //获取网址

 这个可以的,另外$_SERVER['REQUEST_URI']可以获取全部
你可以print_r( $_SERVER );查看一些信息
------解决方案--------------------
url地址是已知的嘛?
如果是已知的话
可以用strrchr函数
strrchr($url,'/');
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