PHP原生生成EXCEL


<?php /*** * 生成excle文件 ***/ $time = time(); $filename = date("Y年m月d日h點m分s秒", $time).'問卷數據'; $rows = Sp_Looks_Vote::downvote(); $file = $filename.".csv"; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); $tabletitle .= "購買地址,常常購買,喜歡模特,內容如何,印象如何,是否購買,感覺如何,購買方式,購買方式建議,吸引點,改進建議"; $conter = iconv('utf-8','gbk',$tabletitle)."\n"; echo $conter;die; /*** * 生成word文件 ***/ header("Content-Type: application/msword"); header("Content-Disposition: attachment; filename=doc.doc"); header("Pragma: no-cache"); header("Expires: 0"); $output = '<table border="1" cellspacing="2" cellpadding="2" width="90%" align="center">'; $output .= '<tr bgcolor="#cccccc"><td align="center">圖片</td></tr>'; $output .= '<tr bgcolor="#f6f7fa"><td><span style="color:#FF0000;"><strong>下面是一張圖片</strong></span& gt;</td></tr>'; $output .= '<tr><td align="center"><img src="http://zi.csdn.net/48260_2.gif"></td></tr>'; $output .= '</table>'; echo $output; ?>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM