时间:2021-07-01 10:21:17 帮助过:3人阅读
留哪个呢?还是2个 tag_id 都要?
不用只要一个数组[0] => Array
(
[knowledge_id] => 1
[tag_id] => 2
)
设原数组为 $ar, 则
$res = array(); //结果数组foreach($ar as $v) { if(! isset($res[$v['knowledge_id']])) $res[$v['knowledge_id']] = $v;}$res = array_values($res);