【发布时间】:2017-02-20 21:42:30
【问题描述】:
我正在尝试解析一些表数据,但该表没有类或固定数字,所以我试图通过使用 next_sibling() 方法来捕获它。
但如果我找到一个标准表,它会返回 null。我的代码有误吗?
<table class="prettytable mx-auto rounded text-center">
这是我要找到的那条线。
我尝试了这两个代码:
$html_pokemon->find('table.prettytable.mx-auto.rounded.text-center')
$html_pokemon->find('table[class=prettytable mx-auto rounded text-center]')
我做错了什么?
【问题讨论】:
-
打印 $html_pokemon 看看你会得到什么
-
$html_pokemon 得到正确的数据,但发现出错
-
数据中是否真的包含同一个类的同一张表?
标签: php html parsing find simpledom