CakePHP session reading a variable that is not set

The main question is, I set the variable (facebook id) in the cakephp session, if the user is on facebook, if the facebook id is set in the session, I want to do something else. How can I check this?

I am doing something like:

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

Is it correct?

Thanks in advance!

+4
source share
1 answer

The session component has a method called check.

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

CakePHP Session Component Methods Page

+11
source

Source: https://habr.com/ru/post/1389397/


All Articles