query("set names utf8"); $sql="select content from v9_news_data where id='45'"; $a=$db->query($sql)->fetchall(PDO::FETCH_ASSOC); echo ''; print_r($a[0]['content']); ob_start(); //打开缓冲区 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();//输出全部内容到浏览器