The*_*der 2 php phpexcel yii-components yii-extensions yii2
我曾尝试使用PHPExcel库来读取excel文件并显示文件中的数据.但它不适合我.
我也尝试过使用yii2-phpexcel扩展以及其他一些方法,但没有任何方法可以帮助我.我希望我能得到专家人员的帮助.
我在CakePHP中使用PHPExcel从excel读取数据,但我不知道如何在Yii 2中使代码可行.如何在Yii2中加载PHPExcel?我正在使用XLSX.在CakePHP中,我可以使用 -
App::import('Vendor', 'Excel/reader');
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read(WWW_ROOT . 'uploads/' . $_FILES["filename"]["name"]);
$cells = $data->sheets[0]['cells'];
Run Code Online (Sandbox Code Playgroud)
提前致谢.
使用composer 安装phpoffice/phpexcel扩展:
composer require phpoffice/phpexcel
Run Code Online (Sandbox Code Playgroud)
在你看来:
$objPHPExcel = \PHPExcel_IOFactory::load('./test.xlsx');
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
print_r($sheetData);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12755 次 |
最近记录: |