php 导出word文档,默认为“页面视图”的简单示例

PHP导出word文档 认为“页面视图”实例感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编两巴掌来看看吧!

/**
 * PHP导出word文档 认为“页面视图”实例
 *
 * @param 
 * @arrange 512-笔记网: jb51.cc
 **/
<?PHP 
header(Content-Type:application/msword); 
header(Content-disposition:attachment;filename=doc.doc); //指定文件名称 
header(Pragma:no-cache);
header(Expires:0);
$html = '<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><body>';
$html .= '<table border=1 cellspacing=2 cellpadding=2 width=90% align=center>';
$html .= '<tr bgcolor=#cccccc><td align=center>http://info.zg700.com/</td></tr>';
$html .= '<tr bgcolor=#f6f7fa><td><span style=color:#FF0000;><strong>PHP将网页代码导出word文档</strong></span></td></tr>';
$html .= '<tr><td align=center><img src=/upload/header.gif></td></tr>'; //自定义图片文件
$html .= '</table>';
$html .= '</table></body></html>';
echo $html;

/***   来自编程之家 jb51.cc(jb51.cc)   ***/

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...