How I can install the PHPExcel library in laravel?(如何在 laravel 中安装 PHPExcel 库?)
问题描述
我正在尝试使用这个库来创建 excel 文件,但不是如何安装它.我正在考虑从其主页下载该库 (http://phpexcel.codeplex.com/wikipage?title=Examples) 但也不知道应该放在哪个文件夹.如何安装?
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?
推荐答案
你应该使用 composer: 将 "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 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 laravel 中安装 PHPExcel 库?


基础教程推荐
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- 将变量从树枝传递给 js 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- php中的PDF导出 2022-01-01
- php中的foreach复选框POST 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01