日期:2014-05-16  浏览次数:20370 次

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

怎样实现将下列两个文件放入同一excel   mod.xls的不用sheet,sheet1和sheet2里面
第一个php<?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";
}

?>




<?php


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 文件导入到多个工作簿呢?