我使用curl在俄语中使用utf-8获取页面.如果我回复文字它显示良好.然后我使用这样的代码
$dom = new domDocument;
/*** load the html into the object ***/
@$dom->loadHTML($html);
/*** discard white space ***/
$dom->preserveWhiteSpace = false;
/*** the table by its tag name ***/
$tables = $dom->getElementsByTagName('table');
/*** get all rows from the table ***/
$rows = $tables->item(0)->getElementsByTagName('tr');
/*** loop over the table rows ***/
for ($i = 0; $i <= 5; $i++)
{
/*** get each column by tag name ***/
$cols = $rows->item($i)->getElementsByTagName('td');
echo $cols->item(2)->nodeValue;
echo '
';
}
$html包含俄语文本.在它行echo $cols-> item(2) – > nodeValue之后;显示错误文本,而不是俄语.我尝试iconv但不工作.有任何想法吗?