>  기사  >  백엔드 개발  >  php导入到Excel 的 utf8、gbk 编码_PHP教程

php导入到Excel 的 utf8、gbk 编码_PHP教程

WBOY
WBOY원래의
2016-07-13 17:34:441189검색

php导入到excel-支持utf8和gbk两种编码

php导入到excel乱码是因为utf8编码在xp系统不支持所有utf8编码转码一下就完美解决了

utf-8编码案例

header("Content-Type: application/vnd.ms-excel; charset=UTF-8"); 
header("Pragma: public"); 
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Content-Type: application/force-download"); 
header("Content-Type: application/octet-stream"); 
header("Content-Type: application/download"); 
header("Content-Disposition: attachment;filename=11.xls "); 
header("Content-Transfer-Encoding: binary "); 
?> 
 
$filename="php导入到excel-utf-8编码"; 
$filename=iconv("utf-8", "gb2312", $filename); 
echo $filename; 
?> 

gbk编码案例

header("Content-Type: application/vnd.ms-excel; charset=UTF-8"); 
header("Pragma: public"); 
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Content-Type: application/force-download"); 
header("Content-Type: application/octet-stream"); 
header("Content-Type: application/download"); 
header("Content-Disposition: attachment;filename=11.xls "); 
header("Content-Transfer-Encoding: binary "); 
?> 
 
$filename="php导入到excel-utf-8编码"; 
echo $filename; 
?> 

访问网站的时候就下载到excel里面

要弄单元格区别的话

用table表格做网页的就可以了
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/508436.htmlTechArticlephp导入到excel-支持utf8和gbk两种编码 php导入到excel乱码是因为utf8编码在xp系统不支持所有utf8编码转码一下就完美解决了 utf-8编码案例 ?php h...
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.