致命错误:在 phpExel 中找不到类“PHPExcel_IOFactory”

Anj*_*ani 5 php phpexcel

我使用了下面的代码,所有 PHPexcel 库数据都在下图中。

<?php
$inputFileName = './NIB.xlsx';
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);

$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
?>
Run Code Online (Sandbox Code Playgroud)

图像

我想阅读 NIB.xlsx 文件,并且我已阅读此帮助链接

但是,当我运行 PHP 脚本时,收到以下错误:

致命错误:在 untitled-2.php 的 phpExcel 中找不到类“PHPExcel_IOFactory”

aff*_*faz 5

我认为您忘记包含 PHPExcel 文件 在代码开头添加此行

require 'PHPExcel/Classes/PHPExcel.php';
Run Code Online (Sandbox Code Playgroud)

不要忘记添加文件夹的路径,以防它位于不同的文件夹中