我一直在到处搜索,但似乎找不到答案,我想以原始文本检索网站的源代码,我尝试了一些方法,例如
$("#divname").html('<object data="http://example.com/">');
但你得到的只是一个加载了网站的 div,如果我将它更改为 .text 或 .val,它将无法工作:/
我们将不胜感激任何帮助
最佳答案
通过使用 file_get_contents或 Curl .
<?php
echo '<div id="divname">' . htmlspecialchars(file_get_contents('http://example.com')) . '</div>';
关于php - 如何获取网站源作为原始文本 Jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17275497/