Home  >  Article  >  Backend Development  >  怎样得到$_SERVER['QUERY_STRING']等号前的内容解决思路

怎样得到$_SERVER['QUERY_STRING']等号前的内容解决思路

WBOY
WBOYOriginal
2016-06-13 11:59:361183browse

怎样得到$_SERVER['QUERY_STRING']等号前的内容
例如new?forum_id=PHP
怎样用$_SERVER['QUERY_STRING']得到forum_id
各位大大指点一下吧,谢谢
------解决方案--------------------

$s = $_SERVER['QUERY_STRING'];<br /><br />//用 parse_str 解析<br />parse_str($s, $a);<br />echo key($a);<br /><br />//用 strtok 解析<br />echo strtok($s, '=');<br />

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