php 下载word 含图片

 
ob_start();//打开输出缓冲区
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>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>/*这句不能少,否则不能识别图片*/
            <xml><w:WordDocument><w:View>Print</w:View></xml>
</head>';
echo '
<body> <h1 style="text-align: center">xxx的简历</h1>
 <h3 style="text-align: left">编号:000001</h3>
 <table border="0" cellpadding="3" cellspacing="0" width="100%">
     <tr>
     <td style=" margin:10px;display: inline-block;width: 200px;float: left;" height="200" colspan="2" rowspan="5" align="center" valign="middle" >
         <img src="http://www.xxx.com/1.jpg" width="200" height="200" />
     </td>
     <td style="display: inline-block;margin-top: 12px" valign="center" colspan="2" >
         <table border="0" cellpadding="3" cellspacing="0" width="100%" style="font-size:15px">
             <tr><td width="160" height="29" style="font-size:21px" valign="center" colspan="2" >姓名</td></tr>
             <tr><td height="27" width="270" valign="center" colspan="1" >男 18岁 四川省 成都市 0年经验</td></tr>
             <tr><td height="27" width="89" valign="center" colspan="1" >手机:139****5844</td></tr>
             <tr><td height="27" width="156" valign="center" colspan="1" >邮箱:2***8907@qq.com</td></tr>
             <tr><td height="27" width="156" valign="center" colspan="2" >户籍:山西-太原</td></tr>
             <tr><td style="font-size:12px;margin-top: 20px;display: inline-block"  valign="center" colspan="1" >更新时间:2018-09-28 10:22</td></tr>
         </table>
     </td>
     </tr>
</table></body>
';
header("Cache-Control: public");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
if (strpos($_SERVER["HTTP_USER_AGENT"],'MSIE')) {
    header('Content-Disposition: attachment; filename=test.doc');
}else if (strpos($_SERVER["HTTP_USER_AGENT"],'Firefox')) {
    Header('Content-Disposition: attachment; filename=test.doc');
} else {
    header('Content-Disposition: attachment; filename=test.doc');
}
header("Pragma:no-cache");
header("Expires:0");
ob_end_flush();//输出全部内容到浏览器

  

转载于:https://www.cnblogs.com/5aiQ/p/9719797.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值