本文介绍了我如何在laravel中安装PHPExcel库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用此库来创建excel文件,但不是如何安装它。我正在考虑从其主页下载图书馆(),但也不知道应该放置什么文件夹。如何安装?
I'm trying to use this library to create excel files but not how to install it. I was considering to download the library from its home page (http://phpexcel.codeplex.com/wikipage?title=Examples) but also do not know what folder should I place it. How I can install?
推荐答案
您应该使用作曲者:添加 phpexcel / phpexcel:dev-master
到您的 composer.json
"require": {
"phpexcel/phpexcel": "dev-master"
}
然后执行 composer update
。所以你可以正常使用它:
Then execute composer update
. So you can use it as normal:
public function import($path){
$objPHPExcel = PHPExcel_IOFactory::load($path);
$objWorksheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorksheet->getHighestRow();
for ($row = 1; $row <= $highestRow; ++$row) {
var_dump($objWorksheet->getCellByColumnAndRow(1, $row));
}
}
这篇关于我如何在laravel中安装PHPExcel库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!