如果你直接运行我给的代码,出现乱码的话,就证明你使用的是 utf-8 字符集
$str = "你是一只狗"; $str = iconv('gbk', 'utf-8', $str); //已是 utf-8 就不需要 $str = preg_replace('/./u', '<font>$0</font>', $str); $str = iconv('utf-8', 'gbk', $str); //已是 utf-8 就不需要 echo $str;
21,887
社区成员
140,363
社区内容
加载中
试试用AI创作助手写篇文章吧