php gb2312怎么转换为utf8?
PHP gb2312页面 转换为utf8页面?
<?php $url="upload/chengyu/gb2312.html"; //echo $url;exit; $html=file_get_contents($url); $html = preg_replace('/charset=gb2312/', 'charset=UTF8', $html); //$enc = mb_detect_encoding($html); $html = iconv('gbk', 'utf-8', $html); print_R($html);exit; ?>
参考
https://php.net/manual/en/function.iconv.php
https://www.php.net/manual/en/function.preg-replace.php