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>