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();//输出全部内容到浏览器