//$result 是你数据库里的数据 ,下面的代码就可以直接用 很简单的 ,不明白的直接问我就好了
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Disposition: attachment; filename=ABC_Users.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo iconv("utf8","gb2312","用户id\t");
echo iconv("utf8","gb2312","用户名\t");
echo iconv("utf8","gb2312","手机\t\n");
foreach($result as $key=>$val){\
echo iconv("utf8","gb2312",$val['id'])."\t";
echo iconv("utf8","gb2312",$val['name'])."\t";
echo iconv("utf8","gb2312",$val['mobile'])."\t\n";
}
下载一个PHPMYADMIN 装到服务器上就行了,想怎么导怎么导。