时间:2021-07-01 10:21:17 帮助过:6人阅读
array(2) {
[0] => array(5) {
["picTitle"] => string(33) "标题1"
["picCategroy"] => string(6) "分类"
["picAuthor"] => string(12) "作者"
["picPostTime"] => string(19) "2014-11-20 16:05:16"
["pictureurl"] => string(55) "attachment/picture/uploadify/20141120/546da0784831c.png"
}
[1] => array(5) {
["picTitle"] => string(33) "标题1"
["picCategroy"] => string(6) "分类"
["picAuthor"] => string(12) "作者"
["picPostTime"] => string(19) "2014-11-20 16:05:16"
["pictureurl"] => string(55) "attachment/picture/uploadify/20141120/546da0746edb8.png"
}
}
$ar = array(
array(
"picTitle" => "标题1",
"picCategroy" => "分类",
"picAuthor" => "作者",
"picPostTime" => "2014-11-20 16:05:16",
"pictureurl" => "attachment/picture/uploadify/20141120/546da0784831c.png",
),
array(
"picTitle" => "标题1",
"picCategroy" => "分类",
"picAuthor" => "作者",
"picPostTime" => "2014-11-20 16:05:16",
"pictureurl" => "attachment/picture/uploadify/20141120/546da0746edb8.png",
),
);
foreach(call_user_func_array('array_merge_recursive', $ar) as $key=>$item) {
$res[$key] = join(',', array_unique($item));
}
var_export($res);
array (
'picTitle' => '标题1',
'picCategroy' => '分类',
'picAuthor' => '作者',
'picPostTime' => '2014-11-20 16:05:16',
'pictureurl' => 'attachment/picture/uploadify/20141120/546da0784831c.png,attachment/picture/uploadify/20141120/546da0746edb8.png',
)
$arr = array(
array(
"picTitle" => "标题1",
"picCategroy" => "分类",
"picAuthor" => "作者",
"picPostTime" => "2014-11-20 16:05:16",
"pictureurl" => "attachment/picture/uploadify/20141120/546da0784831c.png",
),
array(
"picTitle" => "标题1",
"picCategroy" => "分类",
"picAuthor" => "作者",
"picPostTime" => "2014-11-20 16:05:16",
"pictureurl" => "attachment/picture/uploadify/20141120/546da0746edb8.png",
)
);
$item=array();
foreach($arr as $key=>$value){
foreach($value as $k=>$v){
if(!isset($item[$k])){
$item[$k]=$v;
}
}
}
print_r($item);