>  기사  >  백엔드 개발  >  请教zendframework有导入数据到数据库,导出数据库的接口吗

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

WBOY
WBOY원래의
2016-06-13 13:44:10771검색

请问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向它学习

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.