localhost(wamp)与phpExcel库上的主机之间的区别没有数据收到错误

时间:2014-04-02 14:00:51

标签: php phpexcel

我使用带有以下代码的phpExcel库从xls文件中读取了一些数据:

$fisierInbound = "inbound.xls";

callsInbound();

function callsInbound() {

        global $fisierInbound;
        global $current;

        global $con;

        $identify = PHPExcel_IOFactory::identify('daily/' . $fisierInbound);
        $objReader = PHPExcel_IOFactory::createReader($identify);
        $objReader->setReadDataOnly(true);
        $objPHPExcel = $objReader->load('daily/' . $fisierInbound);
        $objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
        //$objWorksheet = $objPHPExcel->getActiveSheet();

        $query = mysqli_query($con, "SELECT * FROM users WHERE tip_user='agent' AND NOT (departament='online')");

        while($usr = mysqli_fetch_array($query)) {
                        $data[] = $usr;
        }

        foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {

            $worksheetTitle     = $worksheet->getTitle();
            $highestRow         = $worksheet->getHighestRow(); // e.g. 10
            $highestColumn      = $worksheet->getHighestColumn(); // e.g 'F'
            $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
            $dataCalls = $worksheet->getCellByColumnAndRow(2, 2)->getValue();
            $dataSubstr = substr($dataCalls, 53);
            echo $dataSubstr;
            foreach ($data as $db) {

                for ($row = 6; $row <= $highestRow; ++ $row) {

                    $marca      = $worksheet->getCellByColumnAndRow(3, $row)->getValue();
                    $nr         = $worksheet->getCellByColumnAndRow(4, $row)->getValue();

                    if($db['marca'] == $marca) {
                        mysqli_query($con, "INSERT INTO dailycalls(data, nr, departament, oras, tip, id_user)
                                            VALUES('$dataSubstr', '$nr', '" . $db['departament'] . "', '" . $db['oras'] . "', 'inbound', '" . $db['id'] . "')");
                    }
                }
            }
        }  

}

它在localhost上运行得很完美但是如果我从主机运行它我会收到Chrome错误没有收到数据

  

无法加载网页,因为服务器未发送任何数据。   错误代码:ERR_EMPTY_RESPONSE

但查询运行(数据插入到数据库中)。什么似乎是问题?

谢谢!

0 个答案:

没有答案