Php简单的html dom删除特定类的div
16lz
2021-01-22
I am using the code bellow to get some content. My problem is that i don't know how to avoid/bypass/remove a specific div.
我正在使用下面的代码来获取一些内容。我的问题是我不知道如何避免/绕过/删除特定的div。
html Structure:
<div class="post-single-content box mark-links">
<div class="sharebar-wrap">dfdfdfd</div>
</div>
And i an using the code bellow to get the content:
我使用下面的代码来获取内容:
foreach($html->find('div[class=post-single-content box mark-links]') as $table)
{
$arr44[]= $table->innertext ;
}
How can avoid or remove or bypass to grab the div with class sharebar-wrap? I don't need it!
如何避免或删除或绕过使用class sharebar-wrap获取div?我不需要它!
Cheers!!
2 个解决方案
#1
You can indeed use jQuery as Héctor E mentioned, otherwise you can use raw javascript :
您确实可以使用jQuery作为HéctorE提到,否则您可以使用原始javascript:
document.querySelector('.sharebar-wrap').remove();
更多相关文章
- php二维码/26行代码制作php二维码phpqrcode加grafika水印
- php分页代码的问题,显示了两个当前页码,求大神解答
- PHP开发微信支付代码及支付通知处理
- 请问如何用php实现表单提交后以邮件的形式把表单内容发到邮箱中
- 使用pregex提取最后2个斜杠之间的内容
- HPH+Mysql注入点利用 读取文件内容和导出一句话木马
- 几个有用的php字符串过滤,转换函数代码
- 在Web Page中包含PHP代码
- 刷新php页面而不重载内容?