dede織夢后臺增加php導出到excel功能不出現亂碼,織
導讀:織夢技術織夢技術dede織夢系統怎樣導出后臺的文章或自定義模型中的數據到excel,并且不出現亂碼 在后臺目錄創建一個php文件toexcel.php,在最上面加入代碼; redede5.7模板dede58模板。
dede織夢系統怎樣導出后臺的文章或自定義模型中的數據到excel,并且不出現亂碼
在后臺目錄創建一個php文件toexcel.php,在最上面加入代碼;
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/datalistcp.class.php');
require_once(DEDEADMIN.'/inc/inc_list_functions.php');
加入導出到excel類;
class Excel
{
private $head;
private $body;
public function addHeader($arr){
foreach($arr as $headVal){
$headVal = $this->charset($headVal);
$this->head .= "{$headVal}\t ";
}
$this->head .= "\n";
}
public function addBody($arr){
foreach($arr as $arrBody){
foreach($arrBody as $bodyVal){
$bodyVal = $this->charset($bodyVal);
$this->body .= "{$bodyVal}\t ";
}
$this->body .= "\n";
}
}
public function downLoad($filename=''){
if(!$filename)
$filename = date('YmdHis',time()).'.xls';
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename=$filename");
header("Content-Type:charset=gb2312");
if($this->head)
echo $this->head;
echo $this->body;
}
public function charset($string){
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-18 ,文章dede織夢后臺增加php導出到excel功能不出現亂碼,織主要講述后臺,出現亂碼,織夢網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_29189.html