PHP html简单dom解析器返回null
我试图解析一些表数据,但该表没有类或固定编号,因此我尝试使用PHP html简单dom解析器返回null,php,html,parsing,find,simpledom,Php,Html,Parsing,Find,Simpledom,我试图解析一些表数据,但该表没有类或固定编号,因此我尝试使用next\u sibling()方法捕获它 但如果我找到一个标准表,它将返回null。我的代码出错了吗 <table class="prettytable mx-auto rounded text-center"> 我做错了什么?首先,你需要提出请求。之后,您可以使用SimpleDomHtml。您需要连接到页面进行解析,然后才能得到HtmlDom请求的答案。你忘了“文件获取html”。如果您使用,请找出它的使用算法。当然我
next\u sibling()
方法捕获它
但如果我找到一个标准表,它将返回null。我的代码出错了吗
<table class="prettytable mx-auto rounded text-center">
我做错了什么?首先,你需要提出请求。之后,您可以使用SimpleDomHtml。您需要连接到页面进行解析,然后才能得到HtmlDom请求的答案。你忘了“文件获取html”。如果您使用,请找出它的使用算法。当然我已经做了,代码只是在出错,正如我在$html->find(a,b)中所记得的,find(a,b)总是声明和索引元素。a-选择器;b-indexprint$html\u pokemon并查看您得到了什么$html\u pokemon获得了正确的数据,但find会出错数据是否包含具有相同类的相同表?
$html_pokemon->find('table.prettytable.mx-auto.rounded.text-center')
$html_pokemon->find('table[class=prettytable mx-auto rounded text-center]')