controllers 程式
public function csv()
{
$this->load->helper('download'); //下載函數
$this->load->dbutil();
$sql = "SELECT * FROM class_item order by class_item_sort";
$query =$this->sql_base->sql_result($sql);
$content=$this->dbutil->csv_from_result($query);
$name = 'test.csv';
force_download($name,iconv("UTF-8","Big5",$content));
}
沒有留言:
張貼留言