When exported as an excel file in PHP, the ID card is displayed in scientific notation. how to properly display the ID card column in the generated excel file when PHP exports the records in the database as an excel file, but it is displayed in scientific notation. I don't know how to display it all. The code is as follows: & lt ;? Php & nbsp; header (& quot; contenttexthtml; charsetgb2312 & quot;) when the PHP file is exported as an excel file, the ID card is displayed in scientific notation. how can it be properly displayed?
When PHP exports the records in the database as an excel file, the ID card column in the generated excel file is displayed in scientific notation,
I don't know how to display it all. The code is as follows:
Header ("content = text/html; charset = gb2312 ");
Header ("Content-type: application/vnd. ms-excel ");
Date_default_timezone_set ('prc'); // solves the problem that the time is 8 hours earlier;
Header ("Content-Disposition: attachment; filename =". date ('Y _ m_d_H_ I _s '). ". xls ");
Echo"
";Echo"
Student Information Table |
";Echo"
";Echo"
Serial Number | ";Echo"
Student Name | ";Echo"
ID card number | ";Echo"
";$ I = $ number;While ($ rows = mysql_fetch_array ($ result )){Echo"
";Echo"
". $ I ." | ";Echo"
". $ Rows ['app _ name']." | ";Echo"
". $ Rows [" app_id_card "]." | ";Echo"
";$ I --;}Echo"
";
?>
It must be noted that the field attribute of the ID card in the database uses: varchar
In addition, if you add'
Echo"'". $ Rows [" app_id_card "]."";
In excel, the ID card is also displayed in full, but there is ',
Double-click the cell and the cell will generate a small triangle in the upper left corner.
------ Solution --------------------
Stored in text format
------ Solution --------------------
Echo"". $ Rows [" app_id_card "]."";
In this way, you can