简体   繁体   English

PHP导入Excel表到MySQL CakePHP 1.3

[英]php Import Excel sheet to mysql cakephp 1.3

I will have millions of records in my Excel sheet provided by client, and I am finding a better ready made component or helper in CakePHP 1.3 version to import excel sheet to MySQL database records. 客户端提供的Excel sheet中将有数百万条记录,并且我正在CakePHP 1.3版本中找到更好的现成组件或帮助程序,以import excel sheet to MySQL数据库记录。

Please let me know earliest response with better solution. 请尽快通知我,以便提供更好的解决方案。

I havent found a Plugin for CakePHP which does extensive work. 我还没有找到CakePHP的插件,可以做大量工作。

But you can use PHP Excel as vendors and just import it into the controller and go ahead and do everything. 但是您可以将PHP Excel用作供应商,并将其导入控制器中,然后继续进行所有操作。

You need to use PHP-Excel-Reader 您需要使用PHP-Excel-Reader

For that you have to add excel reader library in your Vendor folder like this vendors\\php-excel-reader and yourdatafile.xls should be under webroot folder 为此,您必须像这样的vendors \\ php-excel-reader这样在您的Vendor文件夹中添加excel阅读器库,并且yourdatafile.xls应该在webroot文件夹下

function index(){
App::import('Vendor', 'php-excel-reader/excel_reader2');
$data = new Spreadsheet_Excel_Reader('yourdatafile.xls', true);

}

try using it 尝试使用

It works fine for me. 这对我来说可以。 Hope it helps u too 希望它也对你有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM