将数据导出Excel文件
方法引用:
- \Phpcmf\Service::L('Phpexcel')->down_excel( $config, $field, $data);
- $config 参数配置
- $field 字段显示配置
- $data 具体数据
示例参考:
- $data = [
- 0 => [ ... ],
- 1 => [ ... ],
- ];
- $config = [
- 'author' => '作者', // 作者
- 'title' => '标题标题', // 标题
- 'border_color' => '000', // 表格框颜色
- 'head_bg_color' => 'eef1f5', // 头部背景颜色
- 'head_font_size' => '12', // 标题字体大小
- 'head_height' => 40, // 标题高度
- ];
- $field = [
- 'A' => [
- 'name' => '范围', // 表格显示名称
- 'type' => 'text', // 显示方式
- 'field' => 'pid', // 对应字段名称
- 'width' => 10, // 宽度
- 'height' => 80, // 高度
- 'align' => 'left', // 居左显示,默认居中
- 'center' => 'true', // 是否居中对齐
- ],
- 'B' => [
- 'name' => '类型',
- 'type' => 'text',
- 'field' => 'tid',
- 'width' => 10,
- ],
- 'C' => [
- 'name' => '卡号',
- 'type' => 'text',
- 'field' => 'sn',
- 'width' => 30,
- ],
- 'D' => [
- 'name' => '密码',
- 'type' => 'text',
- 'field' => 'password',
- 'width' => 20,
- ],
- 'E' => [
- 'name' => '面额',
- 'type' => 'text',
- 'field' => 'value',
- 'width' => 15,
- ],
- 'F' => [
- 'name' => '时间',
- 'type' => 'text',
- 'field' => 'inputtime',
- 'width' => 15,
- ],
- 'G' => [
- 'name' => '二维码',
- 'type' => 'image', // 作为图片显示
- 'field' => 'ewm',
- 'width' => 15,
- 'image_height' => 60, // 图片高度
- 'image_x' => 20, // x坐标开始
- 'image_y' => 20, // y坐标开始
- ],
- ];
- \Phpcmf\Service::L('Phpexcel')->down_excel( $config, $field, $data);
文档最后更新时间:2018-09-19 12:46:44