Access cakephp session (auth) from outside cakephp

前端 未结 3 596
青春惊慌失措
青春惊慌失措 2020-12-11 18:40

I have a CakePHP website with its own login system using the Auth component. I would like to know if the following is possible:

A user has logged in and is navigatin

相关标签:
3条回答
  • 2020-12-11 18:55

    Yes you can access the cakephp SESSION outside cakephp folder. try this session variable

    $_SESSION['Auth']
    

    if it exists then check for user here

    $_SESSION['Auth']['User']
    
    0 讨论(0)
  • 2020-12-11 19:03

    This is not working in Cakephp3. After calling

    session_name("CAKEPHP");
    session_start();
    

    Application session is expiring.

    0 讨论(0)
  • 2020-12-11 19:15

    I'll add you also need to set session name to "CAKEPHP" using

    session_name('CAKEPHP')
    

    just before your external app session_start() otherwise you could not apply Kashif Khan suggested solution :)

    Cheers,

    0 讨论(0)
提交回复
热议问题