Simplehtmldom 重复之前提取的字段

Simplehtmldom repeats the extracted field previously

我想从this page中提取列表,但每次他也重复前面的字段,创建一种"pyramid"。 示例:

You Are Nioh Obtained all trophies.

You Are Nioh A Long Journey Begins Obtained all trophies.Completed "The Man with the Guardian

You Are Nioh A Long Journey Begins They Call Him Anjin Obtained all trophies.Completed "The Man with the Guardian Spirit".Completed "Deep in the

这是我的代码,我哪里错了?我需要创建查询类型以便我可以在数据库中执行。

foreach ($html->find('li.award') as $infop) {
  $escapedHtmlChars .= htmlspecialchars($infop);
  $title  .= $infop->find('div.trophy-title', 0)->plaintext;
  echo $title;
}

通过使用 .= 运算符,您将在循环的每次迭代中附加到您的字符串。只需使用普通的 = 运算符即可!