PHP输出excel文件实例代码 header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:attachment;filename=users.xls" ); echo "公司名称"." "; echo "用户名"." "; echo "密码"." "; echo "二级域名"." "; echo " "; foreach($result[result] as $val){ echo "$val->ComName"." "; echo "$val->UserName"." "; echo "$val->UserTruePw"." "; echo emptyempty($val->DoMainName)?:(http://.$val->DoMainName..jiaomai.com)." "; echo " "; } ?>