PHP入門–POSTで受け取ったデータを文字列型に変換する方法

PHPコード:
function getPostDataInfo(array $_data = array(),$n = ”){
$postData = empty($_data) ? I(‘post.’) : $_data;
$cta = array();
foreach ($postData AS $name=>$value){
if( is_array($value) ){
$cta[] = getPostDataInfo($value,$name);
}else{
if( !empty($_data) ){
$cta[] = $n.'[‘.$name.’]’.’=’.$value;
}else{
$cta[] = $name.’=’.$value;
}
}
}
$cta = implode(‘&’, $cta);
return $cta;
}

Comments are closed.