Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[待审核] 模版中添加验证用户是否登录后跳转对应页面的方法

[复制链接]
yf8687 发表于 2013-4-5 17:02:23 | 显示全部楼层 |阅读模式
比如我们在专题页面希望让登录的用户看到,没有登录的用户提示登录,就可以用这个代码
  1. <!--{if $_G['uid']}-->中间放你的正常显示的页面<!--{else}-->
  2. <div class="nfl" id="main_message">
  3.         <div class="f_c altw">
  4.                 <div id="messagetext" class="alert_info">
  5.                         <p>抱歉,您尚未登录,请登录后访问</p>
  6.                 </div>
  7.                 <div id="messagelogin"></div>
  8.                 <script type="text/javascript">ajaxget('member.php?mod=logging&action=login&infloat=yes&frommessage', 'messagelogin');</script>
  9.         </div>
  10. </div>
  11. <!--{/if}-->
复制代码
解释下,<!--{if $_G['uid']}-->就是判断用户是否登录,如果没有登陆<!--{else}-->后面就跟着是提示用户登录的代码。
分享给大家,不知道是否有更好的方法了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-19 07:49 , Processed in 0.104285 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表