Home >Backend Development >PHP Tutorial >URL传参加密 解密后怎么获取数据

URL传参加密 解密后怎么获取数据

WBOY
WBOYOriginal
2016-06-13 12:25:521759browse

URL传参加密 解密后如何获取数据
URL传参加密


解密后得到 qq=xxx&ww=qqqqq&m=15010101817&rf=qwqw&ip=192.168.1.1 
接下来我要怎样得到每个值呢
截取的话有些值的长度不一定的
按=之后&之前的话 多个=&怎么区分 
求教这里要怎么来得到每个值
------解决思路----------------------
parse_str
------解决思路----------------------

$str = 'qq=xxx&ww=qqqqq&m=15010101817&rf=qwqw&ip=192.168.1.1 ';<br />$arr = explode('&', $str);<br /><br />foreach($arr as $k=>$v){<br />	$res[$k] = explode('=', $v);<br />	$ret[] = $res[$k][1];<br />}<br /><br />print_r($ret);

------解决思路----------------------
$s = 'qq=xxx&ww=qqqqq&m=15010101817&rf=qwqw&ip=192.168.1.1';<br />parse_str($s, $a);<br />print_r($a);
Array<br />(<br />    [qq] => xxx<br />    [ww] => qqqqq<br />    [m] => 15010101817<br />    [rf] => qwqw<br />    [ip] => 192.168.1.1<br />)<br /><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