PHP生成word文档

<?php
header("Cache-Control: public");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
header('Content-Disposition: attachment; filename=test.doc');
header("Pragma:no-cache");
header("Expires:0");
include_once 'config_file.php';   //连接数据库
$data = $_GET;
$usersid = $data['usersid'];
$userinfo = $db->select('users',"usersid = $usersid");
$date = date("Y年m月d日",strtotime($userinfo[0]['graduationtime']));
$hdpic = 'http://www.chsi.wang/'.$userinfo[0]['hdpic'];
// echo '<pre>';
// print_r($userinfo);exit;
echo '
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<style type="text/css">
@page Section1{
  size:595.3pt 841.9pt;
  margin:33.0pt 33.15pt 33.0pt 33.15pt;
}
div.Section1{
  page:Section1;
}
@font-face{
  font-family:楷体;
  src:url("css/font/kaiti.otf");
}
.yzm{overflow:hidden;}
.yzm span{float:left;width:33%;}
.content{font-family:楷体}
.ysh{font-size:12px;font-weight:bold;}
.title{font-weight:bold;text-align:center;}
.tab td{margin:5px 10px;height:50px;}
.mark p{font-size:15px;line-height:15px;margin:15px 30px 30px 10px}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<xml><w:WordDocument><w:View>Print</w:View></xml>
</head>';
echo '<body class="main">
<h1 style="text-align: center">教育部学历证书电子注册备案表</h1>
<div class="Section1">
<table border="1" cellpadding="3" cellspacing="0" class="tab">
<tr >
<td width="93" valign="center" colspan="2" class="title">姓名</td>
<td width="160" valign="center" colspan="9" >'.$userinfo[0]['fullname'].'</td>
<td width="90" colspan="2" rowspan="4" align="center" valign="middle" ><img src="'.$hdpic.'"></td>
</tr>
<tr >
<td width="150" valign="center" colspan="2" class="title">证件号码</td>
<td width="72" valign="center" colspan="2" class="content">'.$userinfo[0]["idcard"].'</td>
<td width="150" valign="center" colspan="2" class="title">毕业日期</td>
<td width="230" valign="center" colspan="6" class="content">'.$date.'</td>
</tr>
<tr >
<td width="93" valign="center" colspan="2" class="title">学历类别</td>
<td width="72" valign="center" colspan="2" class="content">'.$userinfo[0]["educationtype"].'</td>
<td width="88" valign="center" colspan="3" class="title">层次</td>
<td width="89" valign="center" colspan="6" class="content">'.$userinfo[0]["education"].'</td>

</tr>
<tr >
<td width="93" valign="center" colspan="2" class="title">学校名称</td>
<td width="160" valign="center" colspan="9" class="content">'.$userinfo[0]["school"].'</td>
</tr>
<tr >
<td width="93" valign="center" colspan="2"  class="title">专业</td>
<td width="530" valign="center" colspan="11" class="content">'.$userinfo[0]["major"].'</td>
</tr>

<tr>
<td width="93" valign="center" colspan="2" class="title">证书编号</td>
<td width="570" valign="center" colspan="11" class="content">'.$userinfo[0]["certificatenum"].'</td>

</tr>
<tr>
<td width="93" valign="center" colspan="2" class="title">在线验证</td>
<td width="570" valign="center" colspan="11" >
  <table class="yzm">
      <tr>
        <td class="l1">
            <p style="font-weight:bold;text-decoration: underline;">AP823AF4DW28CRWP</p>
            <span style="font-size:14px;">&ensp;&ensp;&ensp;在线验证码</span>
        </td>
        <td class="l2">
            &ensp;&ensp;&ensp;&ensp;<img src="http://www.chsi.wang/images/erweima.jpg"width="80" height="80">
            <p style="font-size:10px;">&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;微信扫一扫,使用小程序</p>
            <p class="ysh">1、扫码获取“学信网报告在线验证”小程序</p>
        </td>
        <td class="l3">
            &ensp;<img src="'.$userinfo[0]["qrcode"].'" width="80" height="80">
            <p style="font-size:10px;">小程序扫一扫,在线验证</p>
            <p class="ysh">2、使用小程序扫码验证</p>
        </td>
      </tr>
  </table>
</td>
</tr>
<tr>
<td width="570" valign="center" colspan="13" >
<div class="mark">
<p style="font-weight:bold;">注意事项:</p>
<p>1、备案表是根据《高等学校学生学籍学历电子注册办法》(教学[2014]11号)对学历证书电子注册复核备案的结果。</p>
<p>2、备案表内容验证办法:①点击备案表(电子版)中的在线验证码,可在线验证;②登录中国高等教育学生信息网“在线验证系统”。</p>
<p>3、备案表内容如有修改,请以最新的在线验证的内容为准。</p>
<p>4、未经学历信息权属人同意,不得将备案表用于违背属人意愿之用途。</p>
<p>5、报告在线验证有效期由报告权属人设置(1~6个月),其在报告验证到期前可再次延长验证有效期。</p>
</div>
</td>
</tr>
</table>
</div>
</body>';
上一篇:使用 pt-table-checksum 检查MySQL数据一致性


下一篇:分支界限算法【0-1背包问题】按照优先队列式(LC)分支限界法求解0-1背包问题, 并给出限界函数,并画出该实例的状态空间树。