Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP html简单dom解析器返回null_Php_Html_Parsing_Find_Simpledom - Fatal编程技术网

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]')