【问题标题】:file_get_contents is picking up all code instead of just the text [duplicate]file_get_contents 正在获取所有代码,而不仅仅是文本 [重复]
【发布时间】:2017-08-24 17:59:29
【问题描述】:

$text = file_get_contents("http://127.0.0.1/name.php?name=Lary");

我想用它来只获取文本,而不是 html。

【问题讨论】:

  • 40分钟后我可以再发一次吗,既然你在这里,你能回答我的问题吗?
  • 你的问题是什么?您要解决的具体问题是什么?解释细节。

标签: php file-get-contents


【解决方案1】:

试试这个我还没有测试过。

$html = file_get_contents("http://127.0.0.1/name.php?name=Lary");

$text = strip_tags($html);

echo ($text);

更多信息在这里:strip_tags

【讨论】:

    猜你喜欢
    • 2014-04-24
    • 1970-01-01
    • 2014-01-14
    • 1970-01-01
    • 2021-09-15
    • 2011-10-08
    • 2020-03-29
    • 2022-12-10
    • 2016-02-06
    相关资源
    最近更新 更多