【发布时间】:2015-08-12 20:51:49
【问题描述】:
我们通过添加以下内容将 PHPExcel 添加到作曲家
致repositories:
{
"type": "package",
"package": {
"name": "PHPOffice/PHPExcel",
"version": "1.9",
"source": {
"url": "https://github.com/PHPOffice/PHPExcel.git",
"type": "git",
"reference": "1.9"
},
"autoload": {
"psr-0": {
"PHPExcel": "src/"
}
}
}
致require:
"PHPOffice/PHPExcel": "1.9.*"
在我们的代码中:
use PHPExcel\IOFactory;
...
$file = $request->get('file');
$inputFileType = IOFactory::identify($file);
我们得到的错误是:
Attempted to load class "IOFactory" from namespace "PHPExcel".
Did you forget a "use" statement for another namespace?
命名空间看起来正确 (https://github.com/PHPOffice/PHPExcel/blob/1.9/src/PhpSpreadsheet/IOFactory.php)。
【问题讨论】: