📄 excel.php
字号:
<?php
/*
导出数据到Excel;
*/
class Excel extends DBModel {
public function export($sql){
//echo $sql;
ob_start();
$sql = preg_replace('/limit (\d+),(\d+)/is', '' , $sql);
if ($sql)
$data = ($this->_DB->fetAll($sql));
if (count($data)>0){
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=".date("Y-m-d")."export.xls");
$body = implode("\t", array_keys($data[0]))."\n";
foreach ($data as $row){
$body.= implode("\t", array_values($row))."\n";
}
echo $body;
}
ob_flush();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -