$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>
点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿
发表
评论
返回
顶部