PHP excel output is easy. To export PHP Data to an excel table, PHP has excellent support in this aspect. PHP can output a simple excel table in just a few simple sentences. PHP code: header (Content-type: applicati needs to output PHP Data to an excel table. PHP supports this very well, 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 "second-level 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 "";
}
?>
Pay attention to the encoding problem, because the table generally outputs UTF-8 encoding. Garbled characters appear when I output data in table form (table + tr + td .... Because my page code is GB2312 and can be converted to iconv, it is best to use the above method to output the code to prevent garbled characters.
Bytes. PHP code: header (Content-type: applicati...