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

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

WBOY
WBOYOriginal
2016-06-23 14:39:531251browse

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

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

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


回复讨论(解决方案)

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

乱码问题 转下编码就好了

可以加个空格或者"'"

需要设置编码

Statement:
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