PHP检查字符串编码和转化编码

<?php

$title
= 'abc'; $encode = mb_detect_encoding($title, array('ASCII','UTF-8','GB2312','GBK','BIG5')); echo $encode; echo '<br>'; if ($encode != 'UTF-8'){ $title = iconv($encode,'UTF-8',$title); } echo $title; echo '<br>'; $encode = mb_detect_encoding($title, array('ASCII','UTF-8','GB2312','GBK','BIG5')); echo $encode; echo '<br>';

 

posted @ 2017-09-07 12:59  Zel+_+  阅读(168)  评论(0编辑  收藏  举报