关于 php:如何使用 CodeIgniter 管理会话和用户? | 珊瑚贝

How to manage sessions and users with CodeIgniter?


我正在将我的网站迁移到 CodeIgniter 框架中。我以前从未使用过 MVC 框架,所以这是一大步。

在我的旧网站中,每个页面的顶部都会有 include(“session_handler.php”);。此脚本将检查会话变量、验证会话并将内容存储在数据库中。

有没有办法让这个脚本自动包含在每个页面中?我可以在配置中指定它吗? CI 是否可能有一种处理会话的内部方法优于我的方法?


Code Igniter 有一个可以使用的 Session 类。

它还具有自动加载功能。

我认为这两件事应该可以满足您的要求…

如果您需要对会话进行额外验证,您可以扩展核心会话类(如果您只是在框架上开始,这可能会要求太多)或者您可以创建自己的库并自动加载它在第一个会话之后运行一些额外的代码..

  • 这似乎正是我正在寻找的。我会试试这个。


来源:https://www.codenong.com/9050315/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_8935.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?