function GetOneImgUrl($img,$ftype=1){
if($img <> ''){
$dtp = new DedeTagParse();
$dtp->LoadSource($img);
if(is_array($dtp->CTags)){
foreach($dtp->CTags as $ctag){
if($ctag->GetName()=='img'){
$width = $ctag->GetAtt('width');
$height = $ctag->GetAtt('height');
$imgurl = trim($ctag->GetInnerText());
$img = '';
if($imgurl != ''){
if($ftype==1){
$img .= $imgurl;
}
else{
$img .= '<img src="'.$imgurl.'" style="max-width:90%" height="'.$height.'" / alt="织梦列表页如何调用dede:img" >';
}
}
}
}
}
$dtp->Clear();
return $img;
}
}
标签:ctag,39,img,织梦,&#,dtp,dede,imgurl From: https://www.cnblogs.com/hwrex/p/18355181