zoukankan      html  css  js  c++  java
  • Laravel 中使用原生的 PHPExcel

    1、安装

    composer require maatwebsite/excel 之后,程序中就可以使用 PHPExcel 了

    2、控制器中

    public function export(Request $request)
    {
    $Excel = new PHPExcel();
    $Excel->setActiveSheetIndex(0);
    $sheet = $Excel->getActiveSheet();
    $sheet->setTitle('数据');
    $sheet->setCellValue('A1', '我是你爸爸');
    $sheet->setCellValue('A2', '好啊好呃');

    header('Content-Type:application/download');
    header('Content-Disposition:attachment;filename="foo.xls"');
    $Writer = new PHPExcel_Writer_Excel5($Excel);
    $Writer->save('php://output');
    }

  • 相关阅读:
    Java's Volatile Keyword
    reflection
    Spring
    Stack
    Set
    Vector & ArrayList
    CreateFileDemo
    session原理
    multithreadingDemo
    REST风格
  • 原文地址:https://www.cnblogs.com/mouseleo/p/8629387.html
Copyright © 2011-2022 走看看