parse_str — 将字符串解析成多个变量

$arr2="first=value1&second=value2&third[]=value3&third[]=value4";
parse_str($arr2,$param);
echo "<pre>";
print_r($param);
echo "</pre>";

说明

void parse_str ( string $encoded_string [, array &$result ] )

如果 encoded_string 是 URL 传递入的查询字符串(query string),则将它解析为变量并设置到当前作用域(如果提供了 result 则会设置到该数组里 )。

参数

encoded_string    输入的字符串。        
result   如果设置了第二个变量 result, 变量将会以数组元素的形式存入到这个数组,作为替代。
原文地址:https://www.cnblogs.com/lxwphp/p/15453658.html