Header ("Content-type:application/vnd.ms-excel");
Header ("content-disposition:attachment; Filename=test_data.xls ");
Echo ' ID '. chr (9);
Echo ' Txtpeoclientcode '. chr (9);
Echo ' Jcompany '. chr (9);
Echo ' Fcompany '. chr (9);
Echo ' Ecompany '. chr (9);
Echo ' Rcompany '. chr (9);
Echo ' txtaddress '. chr (9);
Echo ' Txtcompanytel '. chr (9);
Echo ' Txtfax '. chr (9);
Echo ' Txtpostcode '. chr (9);
Echo Chr (13);
$user _list = M (' user ')->select ();
foreach ($user _list as $key = + $value) {
Echo ';
echo $value [' ID '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
echo $value [' Phone '].chr (9);
Echo Chr (13);
}
This article is from the "Day South Side" blog, please make sure to keep this source http://phpnan.blog.51cto.com/2641199/1655133
thinkphp Generating an Excel file