//是否包含
function contain($str,$a)
{
$bool=false;
if(!isempt($a) && !isempt($str)){
$ad=strpos($str,$a);
if($ad>0||!is_bool($ad))$bool=true;
}
return $bool;
}
//返回字符串编码
public function getencode($str)
{
$encode = mb_detect_encoding($str, array('ASCII','UTF-8','GB2312','GBK','BIG5'));
$encode = strtolower($encode);
return $encode;
}
//将$content转化为UTF-8
$bm = $this->getencode($content);
if(!$this->contain($bm, 'utf')){
$content = @iconv($bm,'utf-8', $content);
}
PHP编码转换之iconv
最新推荐文章于 2022-11-16 17:20:52 发布