Xiaomei asked phpExcelReader to read the Chinese Excel file. I have a php file and the user chooses the xls file. ReadExcel. phpPHPcode & lt ;? Phprequire_onceExcelreader.php; $ file_name $ _ REQUEST [file1]; if ($ file_name! & Quot;) {Xiaomei asked phpExcelReader about an error occurred while reading the Chinese Excel file.
I have a php file and select the xls file.
ReadExcel. php
PHP code
SetOutputEncoding ('utf-8'); $ data-> read (iconv ("UTF-8", "GB2312", $ file_name); error_reporting (E_ALL ^ E_NOTICE ); for ($ I = 1; $ I <= $ data-> sheets [0] ['numrows ']; $ I ++) {for ($ j = 1; $ j <= $ data-> sheets [0] ['numcols']; $ j ++) {echo "\"". $ data-> sheets [0] ['cells '] [$ I] [$ j]. "\", ";}echo" \ n ";}}?>
Read Excel
My phpExcelReader is from
Http://cdnetworks-kr-2.dl.sourceforge.net/project/phpexcelreader/Spreadsheet_Excel_Reader/Interim%20update/phpExcelReader.zip
Download.
Changed require_once 'oleread. Inc' in reader. php ';
This place.
I wrote this php page to read non-Chinese Excel files. no error is reported and can be read.
If an Excel file with a Chinese name is read, an error is returned.
The filename XXX.xls is not readable
For example, I have two Excel files in the ddisk root directory, one is abc.xls and the other is test.xls.
The content in the two xls is completely consistent.
Reading abc.xls is normal.
Read test. XLS is reported.
The filename test .xls is not readable
I have used phpExcelReader to explain how to modify it.
------ Solution --------------------
Iconv ("UTF-8", "gb2312", $ file_name)
Try this conversion
------ Solution --------------------
Echo iconv ("UTF-8", "gb2312", $ file_name );
What do you get?
------ Solution --------------------
Discussion
The result is as follows:
Test. xls
The filename test .xls is not readable
------ Solution --------------------
Generally, Chinese paths are not supported.
------ Solution --------------------
Reference: http://witmax.cn/php-read-excel.html