$content = file_get_contents($filePath);
$encoding = mb_detect_encoding($content, array('UTF-8', 'ASCII', 'GB2312', 'GBK'));
$content = mb_convert_encoding($content, "UTF-8", $encoding);
快捷键:php 字符转码 转utf-8
源:
sublime_text格式
<snippet>
<content><![CDATA[
\$content = file_get_contents(\$filePath);
\$encoding = mb_detect_encoding(\$content, array('UTF-8', 'ASCII', 'GB2312', 'GBK'));
\$content = mb_convert_encoding(\$content, "UTF-8", \$encoding);
]]></content>
<tabTrigger>php 字符转码 转utf-8(php 字符转码 转utf-8)</tabTrigger>
<scope></scope>
</snippet>
发表评论 取消回复