先把所有的goods_name字段循环取出来放一个数组中比如获得的是$arr = array(‘儿童产品’,‘男士用品’) 那么在循环这个数组
foreach($arr as $key=>$val){
froeach($arrs as $keys=>$vals){
foreach($val as $vkey=>$vval){
if($vval['good_name'] == $val){
$arr[$vval['good_name']][]=$vval;
}
}
}
}思路给你了 具体的自己参考改改呗
写个循环取出来啊···
$arr = array(xxxxx); // 你上面输出的数组
$nameArr = array();
foreach($arr as $data) {
$nameArr[] = $data['goods_name'];
}
print_r($nameArr);
$arr = array();
function arr($arr) {
$goods_name = array();
foreach ($arr as $val) {
$goods_name[] = $val['goods_name'];
}
$newgoods = array_flip($goods_name);
while ($key = key($newgoods)) {
printf("%s--" ,$key);
next($newgoods);
}
}
把数组搞成这样,你让谁看呢!