Home > Backend Development > PHP Tutorial > 求解:phpexcel向单元格中写入汉字的问题

求解:phpexcel向单元格中写入汉字的问题

WBOY
Release: 2016-06-23 14:39:53
Original
1255 people have browsed it

请问如何利用phpexcel向单元格中写入汉字呢,我用了下面的代码

$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B2','你好');
Copy after login

但是B2单元格里面没有内容,如果将汉字换成英语字符的话可以写入,
请问如何解决,谢谢。


回复讨论(解决方案)

gbk环境?
->setCellValue('B2', iconv('gbk', 'utf-8', '你好'));

乱码问题 转下编码就好了

可以加个空格或者"'"

需要设置编码

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template