我需要使用phpexcel将数组中的表单数据添加到excel文件中并发送到电子邮件中

时间:2019-07-12 18:57:59

标签: php phpexcel

preg_match()期望参数2为字符串,在第88行给定phpexcel / lib / PHPExcel / Cell / DefaultValueBinder.php,而mb_substr()期望参数1为字符串,给定phpexcel / lib / PHPExcel / Shared /第581行的String.php

    require_once 'phpexcel/lib/PHPExcel.php';
    $objPHPExcel = new PHPExcel();
    $objPHPExcel->setActiveSheetIndex(0);       
    $sheet = $objPHPExcel->getActiveSheet();
    $row = 2;
$totpet = count($_POST['location_more']);
    for($p = 0; $p < $totpet; $p++ ){
        $sheet->setCellValue('A'.$row,$_POST['location_more']);
        $sheet->setCellValue('B'.$row,$_POST['cultivation_more']);
        $sheet->setCellValue('C'.$row,$_POST['crop_more']);
        $sheet->setCellValue('D'.$row,$_POST['cultivar_more']);
        $sheet->setCellValue('E'.$row,$_POST['young_more']);
        $sheet->setCellValue('F'.$row,$_POST['old_more']);
        $sheet->setCellValue('G'.$row,$_POST['irrigation_wator_more']);
        $sheet->setCellValue('H'.$row,$_POST['drain_water_more']);
        $sheet->setCellValue('I'.$row,$_POST['substrate_water_more']);
        $row++;
    }
    $objPHPExcel->setActiveSheetIndex(0);
    $DOWNLOADPATH = get_site_url();
    $unique_file = date("Y_m_d_h_i_s").'.xlsx';

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
    $objWriter->save($unique_file);

am使用php 5.6.40

0 个答案:

没有答案