与codeIgniter用户认证 [英] User authentication with CodeIgniter

查看:111
本文介绍了与codeIgniter用户认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写使用PHP的Web应用程序。我想使用MVC模式对于这一点,并决定去与 codeIgniter 。我的应用程序将有一些网页,这将需要进行身份验证,以及一些网页不会。我想在一个非常通用的方式来设计这个,所以不应该有code重复。任何一个可以点一些不错的设计/阶级结构这个?

I am writing a web application using PHP. I want to use the MVC pattern for this, and decided to go with CodeIgniter. My application will have some pages which will require authentication, and some pages won't. I want to design this in a very generic way, so that there should be no code duplication. Can any one point to some good "design/class structure" for this?

推荐答案

编写自定义库,就可以自动加载在每个页面视图中的code点火器应用程序。它应该具备的功能是:

Write a custom library that you can autoload in your code igniter app on every page view. It should have functions that:


  • 验证用户IE浏览器。检查如果用户或没有登录

  • 请您在IE中。设置会话变量或什么

  • 请你出去

然后在您的控制器类可以做,以验证函数的调用构造函数,然后根据结果继续正常或重定向到一个登录页面与访问被拒绝的消息。

Then in your controller classes you can do a call to the authentication function in the constructor then depending on the outcome continue as normal or redirect them to a login screen with an access denied message.

请在code点火维基'认证'搜索,并有多项成果,可以帮助的:的的http://$c$cigniter.com/wiki/

Do a search on the code igniter wiki for 'authentication' and there are a number of results that may help: http://codeigniter.com/wiki/

这篇关于与codeIgniter用户认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆