Excel导出数据

function in_export () {
		require admin_ROOT.adminfile.'/include/skintitle/skintitle_member.php';
		require admin_ROOT.adminfile.'/include/inc_member.php';
		require admin_ROOT.adminfile.'/include/systemlist.php';
		parent::start_template();
		//$projectid=$this->accept('ecisp_member_project_id','C');
		header("Content-type:application/vnd.ms-excel");  
		header("Content-Disposition: attachment; filename=Email.xls");   
		header("Pragma: no-cache");   
		header("Expires: 0"); 	
		
		$this->ectemplates->caching=false;
		/*$lng=$this->accept('lng','R');
		$lng=empty($lng) ? $SL['lng'] : $lng;*/
		
		$ec_member_username_id=$this->accept('ecisp_member_username_id','C');
		$ec_member_project_id=$this->accept('ecisp_member_project_id','C');
		$db_table=db_prefix.'email';
		$db_table2=db_prefix.'email_status';
		$db_where="$db_table.userid=$ec_member_username_id and $db_table.projectid=$ec_member_project_id ";

		$sql="SELECT $db_table.*,$db_table2.status as status_name from $db_table LEFT JOIN $db_table2 ON $db_table.status = $db_table2.id where $db_where";
		
		$rs=$this->db->query($sql);	
		
		echo '编号'.chr(9); 
		echo '语言'.chr(9); 
		echo '邮件标题'.chr(9); 	
		echo '邮件正文'.chr(9); 		
		echo '受邀人公司名称'.chr(9); 
		echo '受邀人姓名'.chr(9); 
		echo '受邀人邮件'.chr(9); 
		echo '邀请函编码'.chr(9); 
		echo '发送时间'.chr(9); 	
		echo '发送状态'.chr(9); 		
		echo chr(10);
		while ($rsList=$this->db->fetch_array($rs)) {
			echo $this->htmldecode($rsList['id']).chr(9); 
			echo $this->htmldecode($rsList['lng']).chr(9); 
			echo $this->htmldecode($rsList['send_title']).chr(9); 
			echo $this->htmldecode($rsList['send_memo']).chr(9); 
			echo $this->htmldecode($rsList['company']).chr(9); 
			echo $this->htmldecode($rsList['linkman']).chr(9); 
			echo $this->htmldecode($rsList['email']).chr(9); 
			echo $this->htmldecode($rsList['sys_sn']).chr(9); 
			echo $this->formatdate(3,$rsList[addtime]).chr(9); 		
			echo $this->htmldecode($rsList['status']==1?'发送成功':'发送失败').chr(9); 
			echo chr(10);
		}

	}


你可能感兴趣的:(Excel导出数据)