To output PHP data to Excel tables, PHP supports this very well, and PHP can output a simple Excel table in just a few simple sentences.
PHP Code:
Header ("Content-type:application/vnd.ms-excel");
Header ("Content-disposition:attachment;filename=users.xls");
echo "Company name". "";
echo "User name". "";
echo "Password". "";
echo "Level two domain name". "";
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 "";
}
?>
Note the coding problem because the general output of the table is UTF-8 encoded. I use tabular form (TABLE+TR+TD) output when there is garbled .... Because my page encoding is GB2312, can be used iconv turn also line, in order to prevent garbled oneself again, it is best to use the above method output.
http://www.bkjia.com/PHPjc/486264.html www.bkjia.com true http://www.bkjia.com/PHPjc/486264.html techarticle to output PHP data to Excel tables, PHP supports this very well, and PHP can output a simple Excel table in just a few simple sentences. PHP Code: Header (Content-type:applicati ...