首页 > 解决方案 > 简单的 HTML DOM - 如何通过包含 TD 文本来获取特定的 TR

问题描述

我只需要使用简单的 HTML DOM 从下面的链接中获取所需的行: http ://projects.ednforum.com/salary/tspaydetailsget.php?id=1322733&year=2019-2020

五月或六月或七月或任何其他。

如何仅显示所需的月份行?

我使用了下面的代码,但它不起作用。

include('simple_html_dom.php');

$table = array();
$html2 = file_get_html ('http://projects.ednforum.com/salary/tspaydetailsget.php?id=1322733&year=2019-2020');
$html = str_get_html($html2);
$row = $html->find('table',0)->find('tr');
foreach($row as $data){
  if($data->innertext == $month)
  {
    $value = $data->innertext;
  }
}
echo $value;

标签: phpparsinghtml-parsing

解决方案


推荐阅读