标签:12px 手机 count() width ica star idt size blog
public function download()
{
$strTable =‘<table width="500" border="1">‘;
$strTable .= ‘<tr>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;width:120px;">会员ID</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="100">会员昵称</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">会员等级</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">手机号</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">邮箱</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">注册时间</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">最后登陆</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">余额</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">积分</td>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;" width="*">累计消费</td>‘;
$strTable .= ‘</tr>‘;
$count = M(‘auth_rule‘)->count();
$p = ceil($count/5000);
for($i=0;$i<$p;$i++){
$start = $i*5000;
$end = ($i+1)*5000;
$userList = M(‘auth_rule‘)->order(‘id‘)->limit($start.‘,‘.$end)->select();
if(is_array($userList)){
foreach($userList as $k=>$val){
$strTable .= ‘<tr>‘;
$strTable .= ‘<td style="text-align:center;font-size:12px;">‘.$val[‘id‘].‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.$val[‘name‘].‘ </td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.$val[‘title‘].‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.$val[‘type‘].‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.$val[‘status‘].‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.date(‘Y-m-d H:i‘,$val[‘condition‘]).‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.date(‘Y-m-d H:i‘,$val[‘pid‘]).‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.$val[‘level‘].‘</td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.‘2212‘.‘ </td>‘;
$strTable .= ‘<td style="text-align:left;font-size:12px;">‘.‘5555‘.‘ </td>‘;
$strTable .= ‘</tr>‘;
}
unset($userList);
}
}
$strTable .=‘</table>‘;
$filename = ‘users_‘;
header("Content-type: application/vnd.ms-excel");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".$filename."_".date(‘Y-m-d‘).".xls");
header(‘Expires:0‘);
header(‘Pragma:public‘);
echo ‘<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />‘.$strTable.‘</html>‘;
}
标签:12px 手机 count() width ica star idt size blog
原文地址:http://www.cnblogs.com/JdsyJ/p/7765592.html