function do_dl_csv($f3, $args) { if (!rStaff::_isLogin()) { return parent::_return(8001); } $rows = $this->_db->exec("SELECT * FROM `" . self::fmTbl() . "` ORDER BY insert_ts DESC "); if (!$rows) { header("Content-Type:text/html; charset=utf-8"); echo '無結果'; } else { $template = new Template(); f3()->set('rows', $rows); Outfit::_setXls("contact_" . date("YmdHis")); echo $template->render('contact.dl.html', "application/vnd.ms-excel"); } }
function do_upload_file($f3, $args) { if (!rStaff::_isLogin()) { return parent::_return(8001); } $filename = Upload::saveFile(f3()->get('FILES'), ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/octet-stream", "application/vnd.ms-excel"]); return $this->load_xls($filename); }