中山php|最優(yōu)網(wǎng)絡(luò) :中山做網(wǎng)站 中山php建站
最優(yōu)良人
Posts Tagged With: excel
php生成excel或者word文檔最簡(jiǎn)單的方法
2011/09/29 at 16:29 » Comments (3,306)
以下代碼實(shí)現(xiàn)簡(jiǎn)單輸出表格或者word文檔,如生成一個(gè)兩列的excel文檔,改動(dòng)相應(yīng)文件頭為 header("Content-type:application/vnd.msword"); header("Content-Disposition:filename=test.doc"); 就可以輸出.doc .xls等文件格式了 header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.xls"); echo "test1\t"; echo "test2\t\n"; //兩列之后換行 echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; 附一個(gè)文件格式對(duì)應(yīng)的數(shù)組 $mime_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'bmp' => 'image/bmp', 'png' => 'image/png', 'tif' => ...more »