看代码:
<?php//为什么这样可以输出'因'字?$n='因';$n=iconv("utf-8","gb2312",$n);echo $n[0];echo $n[1];?>
把你的浏览器编码调整为GB2312,页面输出'因'字,不解,为什么$n变成了一个数组了?
回复讨论(解决方案)
这不是数组,而是按偏移访问字符串的某个位置
为了防止误解,php建议你写作 $n{0}、$n{1}
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