file_get_contents() PHP

2019-08-21 03:16发布

问题:

Why have I got trouble with charset on echo?

$url = "http://ru.wikipedia.org";
$site=file_get_contents($url);
echo $site;

回答1:

Try putting header('Content-Type: text/html;charset=utf-8'); at the start of your file



标签: php encoding