-1
我需要一點幫助。我完全停留在這一個。包括php有不同的字符集
我的基本設置正在運行UTF-8。
但我已經包含了一個PHP文件,這是從另一個網站抓取數據,這個網站編碼在ISO-8859-1。
<?php
//header('Content-Type: text/html; charset=ISO-8859-1');
include('simple_html_dom.php');
$html = file_get_html('http://www.hyde.dk/hanstholm/vejrstation.asp');
echo $html->find('.vsdatatable', 4)->plaintext . "<br>";
echo $html->find('.vsdatatable', 1)->plaintext . "<br>";
echo $html->find('.vsdatatable', 2)->plaintext . "<br>";
echo $html->find('.vsdatatable', 5)->plaintext . "<br>";
echo $html->find('.vsdatatable', 6)->plaintext . "<br>";
echo $html->find('.vsdatatable', 9)->plaintext . "<br>";
echo $html->find('.vsdatatable', 7)->plaintext . "<br>";
echo $html->find('.vsdatatable', 3)->plaintext . "<br>";
echo $html->find('.vsdatatable', 11)->plaintext . "<br>";
echo $html->find('.vsdatatable', 10)->plaintext . "<br>";
$html->save();
$html->clear();
unset($html);
?>
如果我用這個:
header('Content-Type: text/html; charset=ISO-8859-1');
它會覆蓋我的整個網站,以及其他一切顯示錯誤。
有人可以幫助我指導我以正確的方向設置正確的方向。
親切的問候 拉塞
使用http://php.net/manual/en/function.utf8-encode.php建立你的HTML結構之前。 – apokryfos