PHP数组的转化

$files = array(

            "name" => array("2374102_middle.jpg","2374102_middle.jpg"),

            "type" => array("image/jpeg","image/jpeg")

);

转化成

$filename = array( 

array("name" => "2374102_middle.jpg","type" => "image/jpeg"),

                array("name" => "2374102_middle.jpg", "type" => "image/jpeg")

        );

 求代码,及分析思路。。。。。。


qq_天蝎的尾巴卍_0
浏览 1152回答 1
1回答

KevenHuang

$filename=array(); foreach($file as $key=>$val){ foreach($val as $k=>$v){ if($k=="name"){ $filename[$k]["name"]=$v; }else{ $filename[$k]["type"]=$v; } } } (纯手打代码)
打开App,查看更多内容
随时随地看视频慕课网APP