linux - linux下的Codeigniter PHPExcel

标签 linux ubuntu phpexcel php-7

我有一个问题。我使用 Codeigniter 框架。我集成了 PHPExcel 库。它在 windows/linux 和 php 5.X 下运行良好。但现在我在 linux (Ubuntu) 和 php 7.0 下试过了。它不起作用。为什么?我启用了 php_zip、php_gd 和 php_xml 模块,但它也不起作用?有任何想法吗?

我的代码id很简单

$this->load->library("excel");
$this->excel->load("/mba/input.xls");
echo"test";
$this->excel->setActiveSheetIndex(0);
$this->excel->getActiveSheet()->SetCellValue('B2', "whatever");
$this->excel->save("/path/to/output.xls");

我看不到测试标签,所以我认为问题出在“加载”部分。 路径正确,error.log 中没有任何内容。当我检查 PHPExcel 类时,我发现了加载函数。我发现,问题在于它想要加载 MY_Excel 类,但它不是 PHPExcel 类的一部分。有什么想法吗?

谢谢

最佳答案

// Controller

require_once APPPATH . '/third_party/Phpexcel/Bootstrap.php';



    // Create new Spreadsheet object
        $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

//Change to excel2007 excel5

$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, '**Excel5**');

$writer->save('php://output');

关于linux - linux下的Codeigniter PHPExcel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44606353/

相关文章:

linux - Bash 函数作为参数给出 -> 本地 archive.tar.gz 中的 ssh 存档远程文件夹 -> echo "test"也打包在 tar 文件中

c - Getopt 为特定的选项顺序返回 -1

macos - 我无法将内容写入 var 文件

从 excel 文件读取日期字段的 PHPExcel 问题

linux - openssh RPM CentOS 6.5 的 Pam 配置

c - 将矩形打印到终端

php - 使用 NetBeans 调试 PHP?

java - Ubuntu:OpenJDK 8 - 无法找到包

PHPExcel - 使用示例读取过滤器

PHPExcel加载函数内存不足