可以用file函数。例如:<?Php 
$lines = file ("D:/ls.php");
// 在数组中循环,显示 html 的源文件并加上行号。
foreach ($lines as $line_num => $line) {
    echo htmlspecialchars($line) . "<br>\n";
}
?>

解决方案 »

  1.   

    file_get_contents可以读
    file_get_contents("http://127.0.0.1/path/file.php");
      

  2.   

    用file_get_contents读出是显示出了他的原代码。
      

  3.   

    $template -> set_var("login",file_get_contents("../../login.htm"));按照这种方法,它显示出来的是源程序代码?
    不是运行后的效果。
      

  4.   

    http://community.csdn.net/Expert/topic/3560/3560127.xml?temp=2.712649E-02重发了一贴!
      

  5.   

    file_get_contents("http://127.0.0.1/path/file.php");
    一定要用url地址,