/**
* @desc 多维数组转化为支持curl提交数组
* @author phpstudy 2013-07-8
*/
public function toPost(array $params = array(), $pre = \'\')
{
$result = array();
foreach ($params as $key => $val)
{
if (is_array($val))
{
$subPre = ($pre==\"\") ? $key : $pre . \"[\" . $key . \"]\";
//$pre = \"[\" . $key . \"]\";
$result = array_merge($result, toPost($val, $subPre));
}
else
{
$result[$pre.\"[\".$key.\"]\"] = $val;
}
}
return $result;
}
本文地址:https://www.stayed.cn/item/23130
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我