happyhardik
happyhardik

Reputation: 25537

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!

Upvotes: 4

Views: 4217

Answers (1)

ThePengwin
ThePengwin

Reputation: 822

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

Upvotes: 11

Related Questions