$send_box_array = array(
'total'=>0, //不重复数据的总条数(总箱数)
'list'=>array() //没有重复数据的数组(箱数名称));
2.在循环检索结果数据中判断重复数据
第一种: isset判断
foreach ($result as $good_list) {// get the total send box num
if(!isset($send_box_array ['list'][$good_list['send_box_no']])){
$send_box_array ['total']++;
$send_box_array ['list'][$good_list['send_box_no']] = '';
}
。。。
}
self::$wms_data[$num]['user_def2'] = $send_box_array ['total'];
第二种: in_array()
foreach ($result as $good_list) {
// get the total send box num
if(!in_array($good_list['send_box_no'], $send_box_array ['list'])){
$send_box_array ['total']++;
$send_box_array ['list'][] = $good_list['send_box_no'];
}
。。。
}
self::$wms_data[$num]['user_def2'] = $send_box_array ['total'];