有时候表单数据量过大,就该用 file_get_contents('php://input')
得到的数据如下:
name[1][]=啊啊&name[2][]=啊啊&name[4][]=搜索&name[6][]=色&address[]=是的&address[]=恩爱&address[]=的我&sss[1]=wean&submit=Submit
可这串数据如何转换成:
Array
(
[name] => Array
(
[1] => Array
(
[0] => 啊啊
)
[2] => Array
(
[0] => 啊啊
)
[4] => Array
(
[0] => 搜索
)
[6] => Array
(
[0] => 色
)
)
[address] => Array
(
[0] => 是的
[1] => 恩爱
[2] => 的我
)
[sss] => Array
(
[1] => wean
)
[submit] => Submit
)
$str = 'name[1][]=啊啊&name[2][]=啊啊&name[4][]=搜索&name[6][]=色&address[]=是的&address[]=恩爱&address[]=的我&sss[1]=wean&submit=Submit';
parse_str($str, $data);
var_export($data);
[]就是数组吧
这不就是x-www-urlencoded类型,为嘛不用$_POST