PHP 把数据表列出来的东西导出成execle格式
<? php header("Content-type:application/vnd.ms-excel");//这两行最重要 header("Content-Disposition:attachment;filename=test_data.xls");//这两行最重要,一定要写上
$tx='参会注册表'; echo $tx."\n\n"; echo "个人信息\t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo "同行人员\t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo "联系人员\t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \t"; echo " \n"; echo "编号\t"; echo "姓名\t"; echo "性别\t"; echo "单位类型\t"; echo "单位名称\t"; echo "职务\t"; echo "办公电话\t"; echo "移动电话\t"; echo "传真\t"; echo "邮箱\t"; echo "邮寄地址\t"; echo "邮编\t"; echo "姓名\t"; echo "性别\t"; echo "职务\t"; echo "电话\t"; echo "邮箱\t"; echo "姓名\t"; echo "性别\t"; echo "职务\t"; echo "电话\t"; echo "邮箱\t\n"; $i=0; $result=mysql_query("select * from zhuce order by id desc"); while($row=mysql_fetch_array($result)){ $i++; echo "$i\t"; echo "$row[name1]\t"; echo "$row[sex]\t"; echo "$row[dwlx]\t"; echo "$row[dwmc]\t"; echo "$row[job1]\t"; echo "$row[tel1]\t"; echo "$row[mob1]\t"; echo "$row[fax1]\t"; echo "$row[email1]\t"; echo "$row[address1]\t"; echo "$row[youbian]\t"; echo "$row[name2]\t"; echo "$row[sex2]\t"; echo "$row[job2]\t"; echo "$row[tel2]\t"; echo "$row[email2]\t"; echo "$row[name3]\t"; echo "$row[sex3]\t"; echo "$row[job3]\t"; echo "$row[tel3]\t"; echo "$row[email3]\t\n"; } ?>
本热测试过,全部通过