foreach($dtp->CTags as $ctag) { if($ctag->GetName()=="img") { if($i==($npos-1)) $preSrc = trim($ctag->GetInnerText()); if($i==($npos+1)) $nextSrc = trim($ctag->GetInnerText()); $i++; } } 核心代码就在这里了,一个foreach循环,自然要修改这里了,修改后如下: foreach($dtp->CTags as $ctag) { if($ctag->GetName()=="img") { if($i==($npos-1)) $preSrc = trim($ctag->GetInnerText()); if($i==($npos+1)) $nextSrc = trim($ctag->GetInnerText()); if($i==$npos) $text = $ctag->GetAtt('text'); $i++; } } |
新闻热点
疑难解答