Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

检测登陆情况

想问一下一般网站都会检测用户的登陆情况,如果用户浏览的页面没有登陆就会跳转到登陆页面是怎么做到的?我是每个页面都去判断登陆了没,怎样才能做到只判断一次呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

如果你是用的面向对象,可以写个基础类,判断是否登录,其他类继承她
如果你是用面向过程,可以通过引进文件的方法实现,在这个文件里面判断是否已经登录


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...