定义
这里展示关注当前用户的粉丝列表
模板
user/fans.html
输出关注列表
{if($lists)} {foreach $lists as $v} <li> <div class="follow-list-item"> {if(isfollow($member['id'],$v['id']))}<div class="each-other"><i class="iconfont iconhuxiangguanzhu3" title="互相关注"></i></div>{/if} <div class="img-box"><img src="{if($v['litpic'])}{$v['litpic']}{else}{$common}user/images/login1.png{/if}" alt=""></div> <h4>{$v['username']}</h4> <p>{if($v['signature'])}{$v['signature']}{else}他很懒,什么都没有留下~{/if}</p> {if(isfollow($member['id'],$v['id']))} <a href="{fun U('user/follow',['uid'=>$v['id']])}" title="取消关注">取消关注</a> {else} <a href="{fun U('user/follow',['uid'=>$v['id']])}" title="关注">关注</a> {/if} </div> </li> {/foreach} {else} <p style="text-align: center;width: 100%;display: block;height: 50px;line-height: 50px;"> 暂无关注~ </p> {/if}
判断是否关注
isfollow($other_id,$member_id) $other_id : 其他人都ID $member_id : 判断人ID 判断 $member_id 是否关注了 $other_id