thinkphp 判断有没有登录 没有登录就自动给他打到登录去

html 代码

<a href="javascript:;" class="user_uid">
        <i class="iconfont icon-gr"></i>
        <span class="db text-center">我的</span>
        <input name="uid" type="hidden" id="user_uid" value="{$user_uid}">
    </a>

 

 

juqery 代码

<script type="text/javascript">
    $('.user_uid').on("click",function(){
        var uid = $('#user_uid').val();
        if(!uid){
            window.location.href = "{:U('Index/login')}";
        }else{
            window.location.href = "{:U('Index/user')}";
        }
    })
</script>

 

posted @ 2017-12-27 14:03  遇事稳坐钓鱼台  阅读(374)  评论(0编辑  收藏  举报