请问用phpExcelReader方式,excel文件名字可以是中文吗?

WBOY
Libérer: 2016-06-23 13:51:18
original
1258 Les gens l'ont consulté

我的代码是

require_once 'phpExcelReader/Excel/reader.php';$data = new Spreadsheet_Excel_Reader();$data->setOutputEncoding('UTF-8');$data->read('物业.xls'); $db = mysql_connect('localhost', 'root', '123456');@mysql_query("set names 'utf8'");    //输出中文 @mysql_select_db('first');           //选择数据库 echo $data->sheets[0]['cells'][1][1];echo $data->sheets[0]['cells'][3][1];
Copier après la connexion


现在excel的名字是英文的,可以读取excel数据,可“物业.xls”,就会报错:
Fatal error: Uncaught exception 'Exception' with message 'Could not open 物业.xls for reading! File does not exist, or it is not readable.' in D:\PHP\htdocs\phpMyAdmin\libraries\PHPExcel\PHPExcel\Shared\OLERead.php:72 Stack trace: #0 D:\PHP\htdocs\phpExcelReader\Excel\reader.php(389): PHPExcel_Shared_OLERead->read('??????.xls') #1 D:\PHP\htdocs\1.php(5): Spreadsheet_Excel_Reader->read('??????.xls') #2 {main} thrown in D:\PHP\htdocs\phpMyAdmin\libraries\PHPExcel\PHPExcel\Shared\OLERead.php on line 72

网上说修改reader.php文件 我试过了,也没用!请问咋整啊?



回复讨论(解决方案)

简体中文 windows 系统的字符集是 gbk 的
而你的程序使用的是 utf-8 字符集,那么中文文件名(utf-8编码的)如何能找得到呢?

简体中文 windows 系统的字符集是 gbk 的
而你的程序使用的是 utf-8 字符集,那么中文文件名(utf-8编码的)如何能找得到呢?



嗯 谢谢版主 我把php文件保存成ansi格式 就可以了
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!