Increase Box Spout speed

0

I have an Amount or load with Box Spout but I do not see the difference in speed increase with PhpExcel, Can someone tell me if I'm doing something wrong?

<?php
     error_reporting(E_ALL ^ E_NOTICE);
     ini_set('display_errors', TRUE);
     ini_set('display_startup_errors', TRUE);
     date_default_timezone_set('America/Bogota');
     require '../../controller/Conexion.php';

     use Box\Spout\Reader\ReaderFactory;
     use Box\Spout\Common\Type;
     require_once '../../library/Spout/vendor/autoload.php';

     if (!empty($_FILES['file']['name'])) {
         $pathinfo = pathinfo($_FILES["file"]["name"]);
         if (($pathinfo['extension'] == 'xlsx' || $pathinfo['extension'] == 'xls') && $_FILES['file']['size'] > 0) {
            $inputFileName = $_FILES['file']['tmp_name'];
            $reader = ReaderFactory::create(Type::XLSX);
            $reader->setShouldFormatDates(true);
            $reader->open($inputFileName);
            $count = 1;
            foreach ($reader->getSheetIterator() as $sheet) {
                foreach ($sheet->getRowIterator() as $row) {
                    if ($count > 1) {
                        $A = $row[0];
                        $B = $row[1];
                        $C = $row[2];
                        $D = $row[3];
                        $E = $row[4];

                        //print_r(data);
                        $c = ("INSERT INTO 'usuarios' VALUES ('$A','$B','$C','$D','$E');");
                        $result = $conexion->query($c);
                    }
                    $count++;
                }
           }
           $reader->close();
       } else {
          echo "Please Select Valid Excel File";
       }
 } else {
     echo "Please Select Excel File";
 }
?>

Thanks in advance.

    
asked by Kygo 26.01.2018 в 21:29
source

1 answer

0

To help you read a file faster, increase the amount of memory:

ini_set("memory_limit","512M");
    
answered by 10.07.2018 в 18:38