php导出word格式数据的代码
<?php /** * 生成word文档的类 * by www.jbxue.com */ class word { function start() { 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">'; } function save($path) { echo "</html>"; $data = ob_get_contents(); ob_end_clean(); $this->wirtefile ($path,$data); } function wirtefile ($fn,$data) { $fp=fopen($fn,"wb"); fwrite($fp,$data); fclose($fp); } } //导出的程序文件 //导出 ---start--- require SITE_ROOT.'include/word.class.php'; //类文件放在根目录下的include文件夹下 $word = new word(); //查询数据填入word 中 $result = $db->query