新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
php怎么轉(zhuǎn)碼文件夾
本文操作環(huán)境:Windows7系統(tǒng),php7.4版,Dell G3電腦。

php怎么轉(zhuǎn)碼文件夾?
PHP轉(zhuǎn)換文件夾下所有文件編碼的實(shí)現(xiàn)代碼
PHP轉(zhuǎn)換文件夾下所有文件的編碼 適合發(fā)布網(wǎng)站的其他編碼版本 比如你有一個(gè)GBK版本 你想有一個(gè)UTF8版本 或者你只有GBK的源碼 你想二次開發(fā) 但是你不想改變IDE的編碼方式 你可以用這個(gè)程序?qū)⑵渑哭D(zhuǎn)化為UTF8:
代碼如下:
$value)
{
iconv_file($value);
}
}
else
{
$contents_before = file_get_contents($filename);
/*$encoding = mb_detect_encoding($contents_before,array('CP936','ASCII','GBK','GB2312','UTF-8'));
echo $encoding;
if($encoding=='UTF-8') mb_detect_encoding函數(shù)不工作
{
return;
}*/
$contents_after = iconv($input_encoding,$output_encoding,$contents_before);
file_put_contents($filename, $contents_after);
}
}
else
{
echo '參數(shù)錯(cuò)誤';
return false;
}
}
iconv_file('./test');
?> 分享標(biāo)題:php怎么轉(zhuǎn)碼文件夾
文章地址:http://m.fisionsoft.com.cn/article/dpsshih.html


咨詢
建站咨詢
