$res=$user->where("login_id='{$username}' OR phone='{$username}'")->find(); $phone=I('param.phone'); $sql='select phone,login_id from pro_cuser where phone="'.$data['phone'].'" or login_id="'.$data['phone'].'" and statu…
select top 1 nid from Users where (userName collate Chinese_PRC_CS_AS=@userName or mobile collate Chinese_PRC_CS_AS=@userName or Email collate Chinese_PRC_CS_AS=@userName) and userPwd=@userPwd 其中 COLLATE Chinese_PRC_CS_AS 为指定SQL server的排序规则Chinese_PR…
在settings.py中配置LOGIN_URL参数: # 用户访问带有(@login_required)标签的页面(view)时,如果没有登录,就会跳转到LOGIN_URL(即登陆url). LOGIN_URL = '/login/' 使用django自带的auth模块进行登录和退出: from django.contrib.auth.models import User from django.contrib import auth from django.http.response imp…