<?php $url = "http://localhost/cp/test.html"; $contents = file_get_contents($url); //如果出现中文乱码使用下面代码 $getcontent = iconv("gb2312", "utf-8",$contents); echo $getcontent; ?> <?php $lines = file('http://localhost/cp/test.html'); foreach ($lines as $line_num => $line) { echo "Line <b>{$line_num}</b> : " . htmlspecialchars($line). "<br />/n"; } ?>