当前位置:Gxlcms > PHP教程 > 关于include("http:///的用法,该如何处理

关于include("http:///的用法,该如何处理

时间:2021-07-01 10:21:17 帮助过:31人阅读

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

1. 其中在product.php中代码如下:

可以完整的显示example.html的信息

2.如果在product.php中加入代码:

就不能显示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
------解决方案--------------------
楼上的都说清楚了。

人气教程排行