《PHP实例:DEDECMS首页挪用图片集里的多张图片》要点:
本文先容了PHP实例:DEDECMS首页挪用图片集里的多张图片,但愿对您有效。假如有疑难,可以接洽咱们。
PHP实例先找到include/common.inc.php文件,把上面代码贴出来(我贴的是我网站上的,详细可按照需求改动):
PHP实例 function Getimg($aid,$imgwith,$imgheight) { global $dsql; $imgurls = ''; $row =$dsql->getone( "select imgurls from dede_addonimages where aid='$aid' "); $imgurls= $row['imgurls'];//获取字段数据 preg_match_all("/\}.+jpg/",$imgurls,$matches);//掏出切合前提的 $new_arr=array_unique($matches[0]);//往除数组中反复的值 $pic_num1=" <dt><DIV class=tu_big><img id=imgInit class=zoom name=imgInit src=\"".substr($new_arr[0],2)."\" /></DIV></dt><dd><ul>"; foreach($new_arr as $key){ $pic_list.="<li><img onmouseover='pic_next(\"".substr($key,2)."\")' src=\"".substr($key,2)."\"' width=".$imgwith." height=".$imgheight." /></li>"; } $pic_end="</ul></dd>"; return $pic_num1.$pic_list.$pic_end;//返归成果 }
请先
!