POST TIME:2021-05-23 02:15
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++;
}
}
|
