我能够使用dbutil()以csv格式下载excel工作表,数据从查询直接存储到工作表中。现在在这里我有数据1和0的列,1表示有效,0表示无效。在这里而不是1和0,并在工作表中将1显示为活动状态,将0显示为无效状态。有人可以帮忙。在此感谢您。型号代码是
$this->load->dbutil();
$this->load->helper('file');
$this->load->helper('download');
$delimiters = ",";
$newline = "\r\n";
$filename = 'Customer_list-'.date("d-m-Y,h:i:s").'.csv';
$this->db->select('company_name as Company_name, contact_no as Contact_number, activation_status as STATUS_0_Inactive_1_Active, DATE_FORMAT(added_on, "%m-%d-%Y") as Customer_since');
$this->db->from('cpro_company_tbl');
$this->db->where('activation_status !=', 5);
$exscldata = $this->db->get();
$dexcel = $this->dbutil->csv_from_result($exscldata, $delimiters, $newline);
force_download($filename, $dexcel);
控制器代码为
$excelfile = $this->Company_model->download_excelfile_comp_db();