在php中使用tidy提取html的一部分

发布于 2024-08-30 18:35:00 字数 111 浏览 7 评论 0原文

我想在 php 中使用 tidy 提取 HTML 的特定部分。

html 页面中有表格,我只想从 html 页面获取该表格。

请帮助并发布解决方案...

谢谢

I want to extract particular part of HTML using tidy in php.

the html page has table in it and i just want to fetch that table from html page.

please help and post the solution....

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七婞 2024-09-06 18:35:00

我认为 PHP Simple DOM 解析器 更适合这项工作。网站上有很好的使用示例。

抓取表格的函数应该如下所示(未经测试但应该可以工作):

echo $html->find('table[id=mytable]', 0)->plaintext;

The PHP Simple DOM parser is better suited for the job I think. There are good usage examples on the site.

A function to grab a table should look like this (untested but should work):

echo $html->find('table[id=mytable]', 0)->plaintext;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文