文章内容如何限制指定会员类型查阅,比如:只能vip会员查阅,代码如何写?

281次浏览 更新日期:2024-01-13 18:07:02 分类:问题求助 评论:1

我的代码如下:



<div class="content">

{if $current_userid}

{$content}


{else}


<div id="ycfs3">

{$content}

<div class="gzback">

<div class="gzm"><img src="{$site[gongzhonghao]}" alt=""></div>

<p class="read-tips">

<span>●提示:</span>VIP会员方可查阅完整信息!<br>

</p>

</div>

</div>

{/if}

</div>


截图:

image.png


解释下以上代码的意思:如果会员已经登录,显示{$content}内容,如果没有的登录,就显示div id="ycfs3"等内容。



其实,我是想要实现,只有VIP会员才可以查看{$content}内容否则就只能查看div id="ycfs3"里面的内容。不知道如何判断用户是否为VIP会员???



还有就是页面顶部是否需要添加“定义userid”??

{php $current_userid = intval(get_cookie('_userid'));}


我来说两句
  • yzmcms
    yzmcms 官网认证 3月前
    {php $current_userid = intval(get_cookie('_userid'));}
    {if $current_userid}
    	{php $userinfo = get_memberinfo($current_userid);}
    	{if $userinfo['vip']&&$userinfo['overduedate']>SYS_TIME}
    			<p>你是VIP</p>
    	{else}
    			<p>你不是VIP</p>
    	{/if}
    {else}
    	<p>请先登录</p>
    {/if}
    1
    回复
作者信息
发布见解
发内容 回顶部