excel导出

//xls 导出
header(“Content-type:text/html;charset=utf-8”);
header(“Content-Disposition:attachment;filename=商品分类数据.xls”);
array= this->db->get(“ecs_category”)->result_array();
str=catid\t.catname\t.keywords\t.catdesc\t.parentid\t.sortorder\t.templatefile\t.measureunit\t.showinnav\t.style\t.isshow\t.grade\t.filterattr\n;foreach( array as k=> v) {
str.= v[‘cat_id’] . “\t” . v[catname]."\t". v[‘keywords’] . “\t” . v[catdesc]."\t". v[‘parent_id’] . “\t” . v[sortorder]."\t". v[‘template_file’] . “\t” . v[measureunit]."\t". v[‘show_in_nav’] . “\t” . v[style]."\t". v[‘is_show’] . “\t” . v[grade]."\t". v[‘filter_attr’] . “\n”;
}
echo $str;

你可能感兴趣的:(excel导出)