【问题标题】:Is it possible to convert iframe to html? [closed]是否可以将 iframe 转换为 html? [关闭]
【发布时间】:2012-12-30 03:27:20
【问题描述】:

是否可以使用 PHP 将 iFrame 转换为页面 HTML(如果这有意义的话),以便搜索引擎可以索引内容?我在这里使用电子表格:

http://www.landedhouses.co.uk/offers/

<p><iframe width='700' height='1200' frameborder='0' src='https://docs.google.com/spreadsheet/pub?key=0Ai0rAM-RzQC4dE1hQ2FpdmFoU29POGFUR1NMQUl2RWc&#038;single=true&#038;gid=1&#038;output=html&#038;widget=true'></iframe></p>

【问题讨论】:

  • iframe 不是 HTML 的原因是什么?
  • file_get_contents('https://docs.google.com/spreadsheet/pub?key=0Ai0rAM-RzQC4dE1hQ2FpdmFoU29POGFUR1NMQUl2RWc&amp;#038;single=true&amp;#038;gid=1&amp;#038;output=html&amp;#038;widget=true')?
  • facepalm..... ty @jeremyharris
  • @TJCrowder iFrame 并不总是 HTML,它也可以是 PDF 文档或 MP3 或其他东西。但这仍然是一个相当“愚蠢”的问题 >.
  • @jeremyharris 这将是对问题的正确回答(而不是“只是”评论)。

标签: php html iframe seo


【解决方案1】:

搜索引擎将遵循 IFrame 中的 URL,除非 robots.txt 或元标记禁止。

很难将 HTML 包含到现有页面中,因为至少必须删除 &lt;head&gt; 和部分 &lt;body&gt;,并且可能修复样式表。

【讨论】:

  • 啊,这很有帮助,谢谢。
【解决方案2】:

要使用 PHP 提取 HTML,可以使用 file_get_contents 函数:

$html = file_get_contents('https://docs.google.com/spreadsheet/pub?key=0Ai0rAM-RzQC4dE1‌​hQ2FpdmFoU29POGFUR1NMQUl2RWc&#038;single=true&#038;gid=1&#038;output=html&#038;wi‌​dget=true');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-18
    • 2013-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-20
    相关资源
    最近更新 更多