答案 0 :(得分:0)
检查用户的唯一ID,并用推送空白数组或空值分隔。
$id= null;
foreach($ variable as $ key => $ value){
if ($id == $value->id || $id == null) {
$insert[] = array(); //insert data
}esle{
$insert[] = array();//balank array
$insert[] = array(); //insert data
}
$id = $value->id;
}
答案 1 :(得分:0)
一个非常粗糙的示例,但希望您能理解其逻辑。
$user_id = 'no_possible_duplicate_user_id';
foreach(){
if($user_id != $current_iteration_user_id){
//code for new row here as a separator
}
// here is the code for displaying each record on an excel row
$user_id = $current_iteration_user_id;
}