注销会话重新访问页面codeigniter
问题是在我注销后,按“上一步”按钮或转到“用户控制/登录”,然后刷新,我没有重定向到登录页面,而是在主页上注销会话重新访问页面codeigniter,codeigniter,session,Codeigniter,Session,问题是在我注销后,按“上一步”按钮或转到“用户控制/登录”,然后刷新,我没有重定向到登录页面,而是在主页上 > controller: user_control > function: login > algorithm: > 1. form validation set rules > 2. get posts of username and password > 3. check if the username is in
> controller: user_control
> function: login
> algorithm:
> 1. form validation set rules
> 2. get posts of username and password
> 3. check if the username is in the database and entered password is equal to the password in the database, if true go to 4. else go to signin page.
> 4. set session
> 5. load view home.php
我已经取消设置并销毁了会话
我在网上找到的一个解决方案是无缓存。它可以工作,但它会提示重新提交表单,当我刷新时,我不会被重定向到登录页面,而是在主页上
> controller: user_control
> function: login
> algorithm:
> 1. form validation set rules
> 2. get posts of username and password
> 3. check if the username is in the database and entered password is equal to the password in the database, if true go to 4. else go to signin page.
> 4. set session
> 5. load view home.php
我怀疑,每次我按下“后退”按钮时,post请求仍然存在,当我刷新时,它会使用表单的posts凭据调用用户控制/登录。您需要将主页或任何其他页面限制为仅登录用户。将其他人重定向到登录页面。查看Ion Auth文档,了解如何执行此操作。您需要将主页或任何其他页面限制为仅登录用户,您可以在我的算法中看到,当登录字段正确时,它会设置会话。在进入任何页面之前,我检查是否有会话,如果有会话,则继续,如果没有,则加载登录页面。