我有一个像这样的数组
$json = [
['No.',"Nama","Luas","D1",null,"D2","DL",null,null],
[null,null,null,"val1","val2","zal1","yal1",'yal2','yal3'],
];
我尝试过的
foreach($firstHeader as $index => $row) {
if($firstHeader[$index] === null) {
if($firstHeader[$index - 1] != null) {
\Log::info([$firstHeader[$index - 1], $counter]);
}
$counter++;
$html .= '<th colspan="'.($counter + 1).'">'. $firstHeader[$index - 1] . '</th>';
} else {
$counter = 0;
if($secondHeader[$index] === null && $row !== null) {
$html .= '<th rowspan="2">'. $firstHeader[$index] . '</th>';
}
if($firstHeader[$index] != null) {
\Log::info([$firstHeader[$index], $counter]);
}
}
}
我的预期结果是
谢谢