我想用PHPExcel阅读Excel电子表格。使用XAMPP在我的本地计算机上一切正常。但是,当我尝试将所有内容上传到服务器(domainfactory)上时,总是会收到此错误:
Warning: require_once(Classes/PHPExcel.php): failed to open stream:
No such file or directory in /kunden/579693_49074/index.php on line 8
Fatal error: require_once(): Failed opening required
'Classes/PHPExcel.php' (include_path='.:/usr/local/lib/php') in
/kunden/579693_49074/index.php on line 8
我的服务器上有excel文件和phpexcel.php。
这是我的代码的样子:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Unbenanntes Dokument</title>
</head>
<?php
require_once "Classes/PHPExcel.php";
$tmpfname = "test.xlsx";
$excelReader = PHPExcel_IOFactory::createReaderForFile($tmpfname);
$excelObj = $excelReader->load($tmpfname);
$worksheet = $excelObj->getSheet(0);
$lastRow = $worksheet->getHighestRow();
echo "<table>";
for ($row = 1; $row <= $lastRow; $row++) {
echo "<tr><td>";
echo $worksheet->getCell('A'.$row)->getValue();
echo "</td><td>";
echo $worksheet->getCell('B'.$row)->getValue();
echo "</td><tr>";
}
echo "</table>";
?>
<body>
</body>
</html>