国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > PHP > 正文

php生成EXCEL的東東

2024-05-04 23:00:48
字體:
供稿:網(wǎng)友

商業(yè)源碼熱門下載www.html.org.cn

可以通過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 僅僅在瀏覽器上顯示。
   


<?php
// ----- 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:

<?php
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
?>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 云南省| 金塔县| 广灵县| 和静县| 东阳市| 建瓯市| 靖西县| 醴陵市| 桓台县| 太仆寺旗| 安新县| 新津县| 四子王旗| 电白县| 镇赉县| 潮州市| 荃湾区| 蓝田县| 图片| 东阳市| 嘉黎县| 嘉峪关市| 托克托县| 赤壁市| 渝中区| 凤山县| 兰州市| 海安县| 卫辉市| 方正县| 石景山区| 昆山市| 深圳市| 龙川县| 应城市| 永春县| 清徐县| 驻马店市| 大足县| 长汀县| 页游|