PHP将HTML页面输出为word文档的办法

PHP将HTML页面输出为word文档,具体实例代码如下: $html = include ('html文件');echo $html; ob_start(); //打开缓冲区 header("Cache-Control: public"); Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); $riqi=date("Ymd"); if (strpos($_SERVER["HTTP_USER_A

PHP将HTML页面输出为word文档,具体实例代码如下:
php">		$html = include ('html文件');
		echo $html;
        ob_start(); //打开缓冲区
        header("Cache-Control: public");
        Header("Content-type: application/octet-stream");
        Header("Accept-Ranges: bytes");
        $riqi=date("Ymd");
        if (strpos($_SERVER["HTTP_USER_AGENT"],'MSIE')) {
            header('Content-Disposition: attachment; filename='.$riqi.'.doc');
        }else if (strpos($_SERVER["HTTP_USER_AGENT"],'Firefox')) {
            Header('Content-Disposition: attachment; filename='.$riqi.'.doc');
        } else {
            header('Content-Disposition: attachment; filename='.$riqi.'.doc');
        }
        header("Pragma:no-cache");
        header("Expires:0");
        ob_end_flush();//输出全部内容到浏览器

		//内容过大输出失败, 请修改php.ini output_buffering
 

本文标题为:PHP将HTML页面输出为word文档的办法

基础教程推荐