zoukankan      html  css  js  c++  java
  • 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";
             }
     
    ?>

    本热测试过,全部通过

  • 相关阅读:
    Updates were rejected because the tip of your current branch is behind 问题出现解决方案
    git初始化本地项目及关联github远程库
    git项目提交后执行添加忽略操作
    HTML5基础总结
    图表Echarts的使用
    百度API使用--javascript api进行多点定位
    HtmlAgilityPach基本使用方法
    Redis可以做哪些事儿?
    Asp.Net将Session保存在数据库中
    css基础学习
  • 原文地址:https://www.cnblogs.com/kingfly/p/3090221.html
Copyright © 2011-2022 走看看