日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > php >内容正文

php

php生成excel教程,php生成EXCEL的东东

發(fā)布時間:2024/9/19 php 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php生成excel教程,php生成EXCEL的东东 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

php生成EXCEL的東東

發(fā)布時間:2016-06-17 來源: 點(diǎn)擊:

可以通過PHP來產(chǎn)生EXCEL檔.??teaman翻譯

----------------------------

Excel Functions

----------------------------

將下面的代碼存為excel.php ,然后在頁面中包括進(jìn)來

然后調(diào)用

1. Call xlsBOF()

2. 將一些內(nèi)容寫入到xlswritenunber() 或者 xlswritelabel()中.

3.然后調(diào)用 Call xlsEOF()

也可以用 fwrite 函數(shù)直接寫到服務(wù)器上,而不是用echo 僅僅在瀏覽器上顯示。

// ----- begin of function library -----

// Excel begin of file header

function xlsBOF() {

echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);

return;

}

// Excel end of file footer

function xlsEOF() {

echo pack("ss", 0x0A, 0x00);

return;

}

// Function to write a Number (double) into Row, Col

function xlsWriteNumber($Row, $Col, $Value) {

echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);

echo pack("d", $Value);

return;

}

// Function to write a label (text) into Row, Col

function xlsWriteLabel($Row, $Col, $Value ) {

$L = strlen($Value);

echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);

echo $Value;

return;

}

// ----- end of function library -----

?>

//

// To display the contents directly in a MIME compatible browser

// add the following lines on TOP of your PHP file:

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");

header ("Cache-Control: no-cache, must-revalidate");

header ("Pragma: no-cache");

header ('Content-type: application/x-msexcel');

header ("Content-Disposition: attachment; filename=EmplList.xls" );

header ("Content-Description: PHP/INTERBASE Generated Data" );

//

// the next lines demonstrate the generation of the Excel stream

//

xlsBOF();???// begin Excel stream

xlsWriteLabel(0,0,"This is a label");??// write a label in A1, use for dates too

xlsWriteNumber(0,1,9999);??// write a number B1

xlsEOF(); // close the stream

?>

這就是微學(xué)網(wǎng)-程序員之家為你提供的"php生成EXCEL的東東"希望對你有所幫助.本文來自網(wǎng)絡(luò),轉(zhuǎn)載請注明出處:http://www.weixuecn.cn/article/1281.html

總結(jié)

以上是生活随笔為你收集整理的php生成excel教程,php生成EXCEL的东东的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。