匯入
[php]view plain
copy
public
function
excel_put()
private
function
excel_fileput(
$filepath
,$data
,$tablename
) }
// 載入excel檔案
$phpexcel
= $phpreader
->load(
$filepath
);
// 讀取excel檔案中的第乙個工作表
$currentsheet
= $phpexcel
->getsheet(0);
// 取得最大的列號
$allcolumn
= $currentsheet
->gethighestcolumn();
// 取得一共有多少行
$allrow
= $currentsheet
->gethighestrow();
// 從第二行開始輸出,因為excel表中第一行為列名
for(
$currentrow
= 2;
$currentrow
<=
$allrow
;$currentrow
++)elseif(
$currentcolumn
<=
$allcolumn
) }
foreach
($data
as$key
=>
$val
) $this
->db->insert(
$tablename
,$data2
);
//print_r($data2);
//echo "
";
} //echo "\n";
echo
"匯入成功"
; } 匯出
[php]view plain
copy
header(
);
header("content-disposition:attachment;filename=123.xls"
);
$array
=$this
->db->get(
"shop_address"
)->result_array();
$str
= "id\tname\tpid\n"
; foreach
($array
as$val
)
echo
$str
;
excel匯入匯出
匯出 yii框架中 header content disposition attachment filename 123.xls arr connection createcommand select from recruit queryall array this db get recruit r...
EXCEL匯入匯出
系統管理員登入,系統下資源管理 分機號列表內容匯出 suppresswarnings rawtypes responsebody public jsonobject selectfenjihaoinxitongforexportbyparam requestparam value fenjihao ...
excel匯入匯出
匯出 匯出相對比較簡單在控制層的關鍵 為 string filename 成果資料 dateutils.getdate yyyymmddhhmmss xlsx listpersonneltitlelist personneltitleservice.findlist personneltitle n...