PHP UTF-8 file_put_contents

时间:2012-10-06 15:28:26

标签: php utf-8 file-get-contents

我想在PHP中使用UTF-8 HTML文件:

$html = file_get_contents ( 'http://google.com/' );
file_put_contents ( 'utf8.html', $html );
// Is not UTF-8. It is ISO-8859-1. I would like UTF-8.

谢谢!

1 个答案:

答案 0 :(得分:1)

您可以使用以下

$html = file_get_contents ('http://google.com/' ); 
file_put_contents('utf8.html', utf8_encode($html));