Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP session reading a variable that is not set

Basic question, I am setting a variable (facebook id) in cakephp session if the user is from facebook, if the facebook id is set in the session I want to do different thing. How can I check that?

I am doing something like:

if(isset($this->Session->read("fbid")) && $this->Session->read("fbid") != "")

Is this correct?

Thanks in advance!

like image 310
happyhardik Avatar asked Dec 22 '22 04:12

happyhardik


1 Answers

The Session Component has a method called check.

if ($this->Session->check('fbid')) {
    //fbid exists in session
}

CakePHP manual page on the session component's methods

like image 129
ThePengwin Avatar answered Dec 24 '22 01:12

ThePengwin