ホームページ >バックエンド開発 >PHPチュートリアル >エンコードの問題
$url ="http://www.amazon.co.jp/dp/B007HDJPOU"; $handle=mb_convert_encoding(file_get_contents($url), 'UTF-8','utf-8, shft-jis, gbk');$sumopen=fopen("001.txt","w");fwrite($sumopen,$handle);fclose($sumopen);
xuzuning は素晴らしいです、変更されました
出力ファイルはまだ文字化けしています
$handle=mb_convert_encoding(file_get_contents($url), 'UTF-8','utf-8, shft_jis, gbk');$sumopen=fopen("001.txt","w");fwrite($sumopen,$handle);fclose($sumopen);
$handle=mb_convert_encoding(file_get_contents($url), 'UTF-8', 'utf-8,Shift_jis, gbk'); 改めて考えてみると、エンコーディングが変換されたと感じます
問題はファイルの書き込みにあるはずです。これに変更してみてください