PHP代码:
/**
* 导出文件
* @return string
*/
public function export()
{
$file_name = "成绩单-".date("Y-m-d H:i:s",time());
$file_suffix = "xls";
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file_name.$file_suffix");
//根据业务,自己进行模板赋值。
$this->display();
}HTML代码:
成绩单 |
||||
| 编号 | 姓名 | 语文 | 数学 | 英语 |
| 1 | Jone | 90 | 85 | 100 |
| 2 | Tom | 99 | 85 | 80 |
上一篇:PHP如何编写App接口
下一篇:php中的序列化方式有哪些