1个回答
展开全部
public function excel(){
$list = M('map') -> select();//var_dump($list);die;
foreach($list as $key => $val){
$uid[$key] = $val['uid'];
}
$uid = arr_to_str(array_unique($uid));
$user_info = json_decode(getUserInfoList($uid));
foreach($user_info as $key => $val){
if(($username = $val -> user_name) || ($username = $val -> true_name) || ($username = $val -> email)){
$username = $username;
}
$user_list[$val->id] = $username;
}
$genre = array('','自然灾害','环境问题','其它','社会问题');
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=益图-".date("Ymd",time()).".xls");
echo iconv('utf-8', 'gb2312', '地图标题'); echo "\t";
echo iconv('utf-8', 'gb2312', '发布人'); echo "\t";
echo iconv('utf-8', 'gb2312', '介绍'); echo "\t";
echo iconv('utf-8', 'gb2312', '分类'); echo "\t";
echo iconv('utf-8', 'gb2312', '发布时间'); echo "\t";
echo "\n";
foreach($list as $key => $val){
echo iconv('utf-8', 'gb2312',$val['title']);echo "\t";
echo iconv('utf-8', 'gb2312',$user_list[$val['uid']]);echo "\t";
echo iconv('utf-8', 'gb2312',t($val['content']));echo "\t";
echo iconv('utf-8', 'gb2312',$genre[$val['genre_id']]);echo "\t";
echo iconv('utf-8', 'gb2312',date("Y-m-d",$val['create_time']));echo "\t";
echo "\n";
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询