我的代码在Windows中工作正常,但在我导出时,它将所有数据导出到单个列而不是导出到多个列。
这是我的代码:
$this->load->dbutil();
$this->load->helper('download');
$query = $this->db->query("SELECT * FROM products");
$csv = $this->dbutil->csv_from_result($query);
force_download('result.csv', $csv);
答案 0 :(得分:0)
为什么不使用分隔符和换行符选项
$this->load->dbutil();
$this->load->helper('download');
$query = $this->db->query("SELECT * FROM products");
$delimiter = ";";
$newline = "\r\n";
$csv = $this->dbutil->csv_from_result($query,$delimiter,$newline);
force_download('result.csv', $csv);