如何在laravel中添加PHPExcel库? [英] how to add PHPExcel library in laravel?
问题描述
我想在laravel中创建包括PHPExcel库的新模块.在哪里放图书馆.如何访问它.
i want to create new module in laravel which include PHPExcel library. where to put library. how to access it.
我已将PHPExcel库放在下面的位置
i have put the PHPExcel library at below location
laravel\project\application\libraries\PHPEXCEL
它给我错误 PHP致命错误:找不到类"PHPExcel".
it give me error PHP Fatal error: Class 'PHPExcel' not found.
推荐答案
您可以使用 PHPExcel Composer软件包.只需将"phpoffice/phpexcel": "dev-master"
添加到您的composer.json
中,然后输入composer update
.这样,库将被安装",您可以正常使用它(例如$objPHPExcel = new PHPExcel();
).不需要手动包含等.
You can use the PHPExcel Composer package. Just add "phpoffice/phpexcel": "dev-master"
to your composer.json
and enter composer update
. This way the library will be "installed" and you can use it as normal (for example $objPHPExcel = new PHPExcel();
) No need for manual includes etc.
2016年5月更新
请使用官方"命令来代替编辑您的composer.json
:
Instead of editing your composer.json
, please use the 'official' command:
composer require phpoffice/phpexcel
这篇关于如何在laravel中添加PHPExcel库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!