【发布时间】:2014-05-20 03:21:48
【问题描述】:
我正在使用 phpexcel,但我遇到了一个问题:创建阅读器对象时出现此错误:
致命错误:在第 170 行的 C:\xampp\htdocs\phpexcel\Classes\PHPExcel\IOFactory.php 中找不到类“PHPExcel_Reader_excel.php”
我的代码是:
<?php
require_once(dirname(__FILE__)."/Classes/phpexcel.php");
//or
require_once(dirname(__FILE__)."/Classes/PHPExcel/IOFactory.php");
//$phpexcel = new PHPExcel();
$reader = PHPExcel_IOFactory::createReader("excel.php");
?>
我在第 170 行检查了 IOFactory.php,发现:
$searchType = 'IReader';
// Include class
foreach (self::$_searchLocations as $searchLocation) {
if ($searchLocation['type'] == $searchType) {
$className = str_replace('{0}', $readerType, $searchLocation['class']);
$instance = new $className();
if ($instance !== NULL) {
return $instance;
}
}
}
但无法找到任何类,因为它们使用的是 _ 而不是 /(路径是 phpexcel\Classes\PHPExcel\Reader 并且有 excel5.php excel2007.php 之类的文件,但不是 excel.php)
怎么了?文档有点混乱
【问题讨论】: