您好,我正在尝试将另一个网站的网页链接包含到我的网站中。 我该怎么做?
我试过了
<?php web_include ('http://website.com/website.html') ; ?>
但是在这条语句之后所有的命令都没有加载。我想直接将另一个网页包含到我的主页中。我的主页完全是用 php 设计的,但另一个是 html 或 php。
我也试过<?php include("http://www.othersite.com/filename.html"); ?>
但是这个 html 根本没有加载。
可能的解决方案: 好的,这就是我正在使用的
<iframe name="FRAMENAME" src="http://website.com/dropdown.html" width="1000" style="z-index:10000" height="40" frameborder="0" scrolling="no" allowautotransparency=true></iframe>
我只是为我的索引页添加了一个下拉菜单。我网站的 CMS 限制我在 IE 中查看 dorpdown。当我查看 dropdown.html 页面时,我可以看到下拉菜单,所以我正在尝试使用 iframe。现在使用 iframe 我也可以在 IE 中看到下拉菜单,但是下拉菜单没有显示在顶部。它显示在网站上其他图片的后面。我如何将它放在其他图像之上。 z-index 不适用于此。
最佳答案
此代码需要在您的 php.ini 中使用 allow_url_include=On
,默认情况下它是禁用的,因为它是 REMOTE CODE EXECUTION,这是 PHP 中最糟糕的情况之一。这称为 Remote File Include (RFI)漏洞。如果此站点上有 PHP 代码,它将在您的服务器上执行。
极度不安全:
<?php include("http://www.othersite.com/filename.html"); ?>
你可能想要的是:
<?php print file_get_contents("http://www.othersite.com/filename.html"); ?>
但是,这在技术上是一个 XSS 漏洞。因此,如果您信任该网站,则没有问题。但你可能想运行 Html Purifer在打印出来之前。
关于php - 在php文件中包含一个网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3224648/