zblog教程 | 2020年05月02日16时56分03秒 | 评论:0
zblog调用文章列表,很多人不会做缩略图调用,今天爱站云把本站使用的分享出来,默认调用文章内第一张图片,样式和大小自己根据自己主题设置吧!
{php} $temp=mt_rand(1,1); $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/"; $content=$article->Content; preg_match_all($pattern,$content,$matchContent); if(isset($matchContent[1][0])) $temp=$matchContent[1][0]; else $temp=$zbp->host."zb_users/theme/$theme/images/pic.jpg"; {/php} <p><img src="{$temp}" alt="{$article.Title}" title="{$article.Title}"></p>
将代码放到你调用的位置即可,php里$temp=$zbp->host."zb_users/theme/$theme/images/pic.jpg";是文章没有图片默认显示图片路径的图片!
使用过程中出现问题或者不懂的小伙伴联系爱站云进行付费操作吧!
相关文章
网友点评
本文暂无评论 - 欢迎您
⎛⎝爱站云⎠⎞
AiZhanCloud.Com