Home  >  Article  >  Backend Development  >  怎么从编码过的url中通过get获取参数

怎么从编码过的url中通过get获取参数

WBOY
WBOYOriginal
2016-06-13 11:10:49848browse

如何从编码过的url中通过get获取参数
http://域名/?id%3D3%26server_id%3Ds1%26sign%3Df44f5ac51cbc95e13102cd5657082dc6

想从这个链接中$_GET到id  server_id  和 sign这三个参数
接收参数的php文件需要如何先处理一下这个链接呢

能不能稍微具体点儿
本人新手菜鸟,谢谢

解码 url php
------解决方案--------------------
引用:
引用:PHP code?12$str = "http://www.baidu.com/id%3D3%26server_id%3Ds1%26sign%3Df44f5ac51cbc95e13102cd5657082dc6";echo urldecode($str);
通过$_GET应该是能获取的

需要获取的参数都是动态的,每次……

<br />$a = explode('&', $QUERY_STRING);<br />$i = 0;<br />while ($i < count($a)) {<br />    $b = split('=', $a[$i]);<br />    echo 'Value for parameter ', htmlspecialchars(urldecode($b[0])),<br />         ' is ', htmlspecialchars(urldecode($b[1])), "<br />\n";<br />    $i++;<br />}    <br />

这个是手册的例子 参考下吧
------解决方案--------------------
var_dump(($_SERVER['REQUEST_URI']));
var_dump(($_SERVER['SCRIPT_NAME']));
------解决方案--------------------
$str = urldecode($_SERVER['QUERY_STRING']);<br />parse_str($str, $get);<br />var_dump( $get['sign'] );
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