Home  >  Article  >  Backend Development  >  URL传参加密 解密后如何获取数据

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

WBOY
WBOYOriginal
2016-06-23 13:24:411268browse

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 ';$arr = explode('&', $str);foreach($arr as $k=>$v){	$res[$k] = explode('=', $v);	$ret[] = $res[$k][1];}print_r($ret);

$s = 'qq=xxx&ww=qqqqq&m=15010101817&rf=qwqw&ip=192.168.1.1';parse_str($s, $a);print_r($a);
Array(    [qq] => xxx    [ww] => qqqqq    [m] => 15010101817    [rf] => qwqw    [ip] => 192.168.1.1)

原来有专门的函数   多谢指教
这么点分不够分 望见谅

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
Previous article:php?分页Next article:IF嵌套如何优化写法?