首页 > 编程语言> > PHP系列 | PHPexcel导入xls格式 ,提示错误:iconv(): Wrong charset, conversion from `CP936' to `UTF-8' i
PHP系列 | PHPexcel导入xls格式 ,提示错误:iconv(): Wrong charset, conversion from `CP936' to `UTF-8' i
作者:互联网
导入xls格式(2003版本)时会报错提示错误信息
iconv(): Wrong charset, conversion from `CP936' to `UTF-8' is not allowed[/var/www/web/vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php:490]
解决办法:
if (self::getIsIconvEnabled()) { return iconv($from, $to, $value); }
修改为
if (self::getIsIconvEnabled()) { if ($to=='UTF-8' && $from=='CP936') { return iconv('UTF-8', 'latin1', $value); } return iconv($from, $to, $value); }
修改后
标签:iconv,return,getIsIconvEnabled,charset,value,UTF,CP936 来源: https://blog.51cto.com/u_7242631/2867315