当前位置:Gxlcms > PHP教程 > 怎样实现将下列两个文件放入同一excel的不要sheet里面

怎样实现将下列两个文件放入同一excel的不要sheet里面

时间:2021-07-01 10:21:17 帮助过:18人阅读

怎样实现将下列两个文件放入同一excel的不用sheet里面

怎样实现将下列两个文件放入同一excel mod.xls的不用sheet,sheet1和sheet2里面
第一个php

header("Content-type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename="mod.xls"');

include('comm.php');
mysql_select_db('test');

$sql = "select * from module6";
$query = mysql_query($sql);
echo"第六单元(1-6)\t\n";
echo "\n";
echo "用户名\t 第1题\t 第2题\t 第3题\t 第4题\t 第5题\t 第6题\t\n";
while($row = mysql_fetch_array($query)){
echo "\n";
echo $row['username']."\t".$row['strategy1']."\t".$row['strategy2']."\t".$row['strategy3']."\t".$row['strategy4']."\t".$row['tellwho']."\t".$row['diag']."\t"."\n";
}

?>






header("Content-type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename="modxls"');

include('comm.php');
mysql_select_db('test');

$sql = "select * from module5";
$query = mysql_query($sql);
echo"第五单元(1-3)\t\n";
echo "\n";
echo "用户名\t 第1题\t 第2题\t 第3题\t \n";
while($row = mysql_fetch_array($query)){
echo "\n";
echo $row['username']."\t".$row['select11']."\t".$row['mailfile']."\t".$row['idea']."\t"."\n";
}

?>
------解决方案--------------------
请用 phpexcel 类

既然你不能从多个工作簿中同时导出 csv 文件,那么怎么能奢望将 csv 文件导入到多个工作簿呢?

人气教程排行