我自己建立的服务器下有2个文件
   product.php  和example.html1. 其中在product.php中代码如下:
<?php include('example.html');?>
可以完整的显示example.html的信息2.如果在product.php中加入代码:
<?php include('http://lusongsong.com/info/post/92.html');?>
就不能显示http://lusongsong.com/info/post/92.html中的内容
问:1.是不是Include是不是只能显示本地服务器的内容
    2.请问我要显示其他服务器的内容,改怎么写?例如http://lusongsong.com/info/post/92.html

解决方案 »

  1.   

    file_get_contents or fopen or curl
      

  2.   

    php.ini 中需要开启 allow_url_include=On 才能include 远程文件,不过如果不是你自己的服务器,一般是没有权限修改php.ini 的,因此安全的做法是用file_get_contents 或者 curl
      

  3.   

    file_get_contents or fopen or curl 或者 iframe
      

  4.   

    include一个远程文件,你要确定那个文件返回来的东西是直接插入php能识别的你试试
    <?php
    <html><body>abc</body></html>
    ?>
    红字部分如果不出错,就能用include获取,自己再想想