CI框架导出数据

public function excel_out(){
    header("Content-type:text/html");
    header("Content-Disposition:attachment;filename=123.xls");
    $array=$this->db->get("city")->result_array();
    $str="id\t"."name\t"."pid\n";
    foreach($array as $val){
        $str.=$val['id']."\t".$val['name']."\t".$val['pid']."\n";
    }
    echo $str;
}

你可能感兴趣的:(CI框架导出数据)