日期:2014-05-17  浏览次数:20507 次

关于include("http:///的用法
我自己建立的服务器下有2个文件
   product.php  和example.html

1. 其中在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

------解决方案--------------------
file_get_contents or fopen or curl
------解决方案--------------------
php.ini 中需要开启 allow_url_include=On 才能include 远程文件,不过如果不是你自己的服务器,一般是没有权限修改php.ini 的,因此安全的做法是用file_get_contents 或者 curl
------解决方案--------------------
file_get_contents or fopen or curl 或者 iframe
------解决方案--------------------
楼上的都说清楚了。