Home  >  Article  >  Backend Development  >  请教zendframework有导入数据到数据库,导出数据库的接口吗

请教zendframework有导入数据到数据库,导出数据库的接口吗

WBOY
WBOYOriginal
2016-06-13 13:44:10800browse

请问zendframework有导入数据到数据库,导出数据库的接口吗
比如从excel导入,导出到excel。先谢谢大家!

------解决方案--------------------
没遇到过,帮顶吧!!!!
------解决方案--------------------
可以的,多文件导入改名,需要最新framework包(大概1.90以上的都可以)

 $upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination(getAppFilePath(C('path.excel_upload')));

$data = null;
$uploadedFilename = '';

try {
// upload received file(s)
$upload->receive();
$uploadedFilename = $upload->getFileName('excelUpload');
} catch (Zend_File_Transfer_Exception $e) {
$e->getMessage();
// TODO: set a notice and redirect url
}

if (file_exists($uploadedFilename)) {
$errorCode = error_reporting();
error_reporting(E_ALL & ~E_NOTICE);

// FileFacade->processImport($uploadedFilename);
require_once(getAppFilePath('/application/util/excel_reader3.php'));
$data = new Spreadsheet_Excel_Reader();
error_reporting($errorCode);
//设置编码
$data->setOutputEncoding('utf-8');
$data->read($uploadedFilename);
------解决方案--------------------
好像木有,
google有个excel项目,还简陋,不过好用
也有phpexcel项目,sourceforte ,那个保存成文件时候比较慢,功能强大,数据量很大(>10W)就要好好考虑下
python有个excel模块,挺不错的,看人家的面向对象,
建议excel向它学习

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn