CodeIgniter global function

后端 未结 3 1416
耶瑟儿~
耶瑟儿~ 2021-01-05 02:25

Where can I place my \"global\" function, which will check, if user is logged in?

Because I want to do something like: user is able to browse some pages only when th

3条回答
  •  走了就别回头了
    2021-01-05 03:27

    Are you using an authentication library? If not I'd suggest one. They come with functions like that.

    Tank Auth for example has: is_logged_in() , which does exactly what you want!

    http://www.konyukhov.com/soft/tank_auth/

    For more info about which library to use you should check out this answer which compares all libs: https://stackoverflow.com/a/476902/576223

    If you don't want an authentication library you can do as suggested by Joe

提交回复
热议问题