获取 XiunoBBS 文章中第一张图片作为标题缩放图

<?php
$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";  
$content = $_thread['message'];  //文章内容  
preg_match_all($pattern,$content,$matchContent);  
if(isset($matchContent[1][0])){  
    $temp = $matchContent[1][0];  
}
?>
要是靠正则匹配出文章的图片,然后选取一个,然后在用$temp 调用
<img src="<?php echo $temp;?>">
想把图片输出在列表,找到view/htm/forum.htm对应文件,然后根据样式自行调整。

如果想实现首页和列表页面调用从而达到缩略图封面效果请找到对应thread_list.inc.htm进行修改调用

給TA打賞
共{{data.count}}人
人已打賞
xiuno

xiuno bbs 各页面用户所在用户组gid的调取方式

2018-9-13 7:57:09

網絡

Wget下载百度网盘文件

2015-8-22 3:49:48

0 Reply AAuthor MManager
    暫無討論,說說你的看法吧
搜索