After php imports an excel file into the MySQL database, how does php display it in text format? after php imports an excel file into the MySQL database, how does php display it in text format?
For example, excel contains 9787509345030
After the database is imported, it becomes 9.78750934503E + 12.
Php reads the database data and finds that it is also 9.78750934503E + 12.
Very angry, asking for help, very complicated mood.
It seems to be numeric.
$ Number = implode ('', explode ('-', $ data-> sheets [0] ['cells '] [$ I] [1]);
$ Number = strval ($ number );
Turn it into a string type. why is the meter or numeric type ????
Reply to discussion (solution)
Your 9787509345030 in excel is not stored in the form of strings ('123'), but modified in the form of a style sheet (otherwise it is also represented in scientific notation)
You can try to use the getFormattedValue method instead of the getValue method.
Your $ data-> sheets [0] ['cells '] [$ I] [1] is faulty.
I learned from CSDN alone
$ Data = new Spreadsheet_Excel_Reader ();
$ Data-> setOutputEncoding ('utf-8 ');
$ Data-> read ($ upload_file_name );
For ($ I = 2; $ I <= $ data-> sheets [0] ['numrows ']; $ I ++)
{
$ User_name = $ _ SESSION ['User _ name'];
$ Book_isbn = $ data-> sheets [0] ['cells '] [$ I] [1]);
$ Book_name = $ data-> sheets [0] ['cells '] [$ I] [2];
$ Book_press = $ data-> sheets [0] ['cells '] [$ I] [3];
}
How did you write it?
How did I write formatted reads? I read the official PHP file and didn't understand it at the moment.