我正在将数据从我的数据库输出到 Excel(必须是 .xls 格式),但是如何告诉 Excel 将数据放入新单元格或开始新行?
/** Set the headers */
header('Content-type: application/vnd.ms-excel');
header('Content-disposition: attachment;filename=referrals.xls');
/** Output the column headers (We don't need the ID, so drop it) */
foreach($referrals[0] as $key => $value) :
$array_keys[$key] = $key;
endforeach;
unset($array_keys['ID']);
echo join('???', $array_keys).'New row???';
/** Output the data */
foreach($referrals as $referral) : foreach($referral as $key => $value) :
$referral_array[$key] = $value;
endforeach;
unset($referral_array['ID']);
echo join('???', $referral_array).'New row???';
endforeach;