致命错误:找不到类'PHPExcel_IOFactory'

时间:2016-11-19 17:06:33

标签: php phpexcel

我正在尝试阅读一些excel单元格并将其内容插入表格中,但我在标题上收到错误。我已经将PHPExcel文件夹解压缩到与我想要使用它们的php文件相同的位置。 IOFactory.php在里面,也检查过,但它似乎不起作用,即使它与另一个项目工作正常。我在想我像往常一样在代码中做了一些愚蠢的错误,所以这里是

<?php 
$connect = mysqli_connect("localhost", "root", "", "productionline");
include ("PHPExcel/IOFactory.php");
$objPHPExcel = PHPExcel_IOFactory::load('1093.xls');
$orderid = mysqli_real_escape_string($connect, $worksheet->getCellByColumnAndRow(S, 1)->getValue());
$customer = mysqli_real_escape_string($connect, $worksheet->getCellByColumnAndRow(V, 2)->getValue());
$productname = mysqli_real_escape_string($connect, $worksheet->getCellByColumnAndRow(AC, 2)->getValue());
$orderdate = mysqli_real_escape_string($connect, $worksheet->getCellByColumnAndRow(D, 2)->getValue());
$deliverydate = mysqli_real_escape_string($connect, $worksheet->getCellByColumnAndRow(I, 2)->getValue());
$sql = "INSERT INTO orders(OrderID, Customer, ProductName, OrderDate, DeliveryDate) VALUES ('".$orderid."', '".$customer."', '".$productname."', '".$orderdate."', '".$deliverydate."')";
mysqli_query($connect, $sql);
header('Location: home.php');
?>

1 个答案:

答案 0 :(得分:0)

示例直接使用require_once '../Build/PHPExcel.phar';而不是IOFactory

您是否通过包含.phar来尝试他们的示例,因为这似乎是记录在案的方法。