这是php manual的原话:将 web 页面读入字符串。参见 file_get_contents()。
$html = implode('', file ('http://www.example.com/'));为什么我用这段代码不行的?1.<?php
2.
3.var $html;
4.$html = implode('', file ('http://www.baidu.com/index.html'));
5.echo '$html';?>错误提示:Parse error: parse error in d:\usr\www\ip\ip.php on line 3

解决方案 »

  1.   

    错误好多啊,1、'$html',把单引号去掉 2、结尾? >,中间不能有空格 3、php变量不用var,除非是在类里 4、implode太多余了 
      

  2.   

    我改成了这样还是提示不对啊:1.<?php
    2.
    3.$html = implode('', file ('http://www.baidu.com/index.html'));
    4.echo $html;
    5.
    6.?>错误提示:Parse error: parse error in d:\usr\www\ip\ip.php on line 3去掉iplode也是不行的。
      

  3.   

    <?php 
    $html = implode(' ', file ( 'http://www.baidu.com/index.html ')); 
    echo $html;
    ?>