Home  >  Q&A  >  body text

Dreamweaver cms custom form data export to excel

How to export custom form data from DreamWeaver cms to excel

phpcn_u2562phpcn_u25622657 days ago1129

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-08-05 08:54:36

    <?php
    $dir=dirname(__FILE__);
    require $dir."/PHPExcel.php";
    $objPHPExcel=new PHPExcel();
    $objSheet=$objPHPExcel->getActiveSheet();
    $objSheet->setTitle("demo");
    //$objSheet->setCellValue("A1","可可")->setCellValue("b1","蛋蛋");
    $array=array(
    array("姓名","年龄"),
    array("大可","58")
    );
    $objSheet->fromArray($array);
    $objWriter=PHPExcel_IOFactory::createWriter($objPHPExcel,"Excel5");
    $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
     
    header('Content-Type: application/vnd.ms-excel');
    header('Content-Disposition: attachment;filename="ch3.xls"');
    header('Cache-Control: max-age=0');
    $objWriter->save("php://output");


    reply
    0
  • Cancelreply