file_get_contents()不会返回正确的内容

时间:2014-01-24 13:42:44

标签: php character-encoding file-get-contents

我使用了以下源代码(文件编码:没有BOM的UTF-8):

<?php

$contents = file_get_contents('http://www.example.com');

?>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <?= $contents; ?>
    </body>
</html>

现在让我们比较原始网站和我自己网站的部分源代码:

我的网站:

  

原网站:

  

ñ

我也尝试了以下代码并得到了相同的结果:

var_dump(file_get_contents('http://www.example.com'));

file_get_contents()如何返回 而不是ñ?

0 个答案:

没有答案
相关问题