Javascript DomDocument->;输出更改的html
下面是我当前提取html的代码 以前Javascript DomDocument->;输出更改的html,javascript,php,html,Javascript,Php,Html,下面是我当前提取html的代码 以前 <td class="winner betting-movement"> 11/8<img src="/images/site/blue-arrow-small.gif" width="6" height="11">6/4 </td> 遗憾的是,最后一行行不通,我想看看是否有人能为我提供一个快速解决方案?你能做echo-htmlentities($dom3->saveHT
<td class="winner betting-movement">
11/8<img src="/images/site/blue-arrow-small.gif" width="6" height="11">6/4 </td>
遗憾的是,最后一行行不通,我想看看是否有人能为我提供一个快速解决方案?你能做
echo-htmlentities($dom3->saveHTML())吗代码>-这将对HTML进行编码,以供用户查看。更多信息:这给了我整个html-我只需要11/8 6/4@JarrattPerkins,然后将问题更改为表示您只需要生成的html中包含更多详细信息的特定文本。格式化您的代码以便于他人阅读将使此问题对潜在的回答者更具吸引力。。。
<html><body><td class="winner betting-movement">$movement = $article->childNodes->item(12)->ownerDocument->saveHTML($article->childNodes->item(12))."<br />";
<? php @$dom3->loadHTML($movement);
$xpath5 = new DOMXPath($dom3);
foreach($xpath5->query('//img[contains(@src, "blue")]') as $link) {
$link->parentNode->replaceChild($dom3->createTextNode(" > "), $link);
}
foreach($xpath5->query('//img[contains(@src, "red")]') as $link) {
$link->parentNode->replaceChild($dom3->createTextNode(" < "), $link);
}
echo $dom3->saveHTML();?>
echo $dom3->saveHTML()->textContent;