Excel导出
header("content-type:text/html;charset=utf-8"); //设置字符集
$dataa = DB::table('users')->get();
$data = json_decode(json_encode($dataa),true); //转为json数组
$str="编号\t权限\账号\t姓名\t密码\t邮箱\t电话\性别\ip\建立时间\修改时间\删除时间"."\n";
foreach($data as $key=>$v){
$str.=implode("\t",$v)."\n";
}
header("content-type:application/vnd.ms-excel");
header("content-disposition:attachment;filename=users.xls");
echo $str;