What is setState() sets in CWebUser?

I tried Yii::app()->user->setState() function to store some global variables, such as user screen name, the company name user belongs to. so far it works very well.

But what is state that setState() sets?

is it a 1) $_SESSION (), is it a 2) cookie? Or it is 3) something else?

When I close the browser and open it again, the state is still valid, because getState() can still get the string data I stored before. so is it a cookie?

Thank you very much!

Take a look from the code it says you what is doing


public function getState($key,$defaultValue=null)

	{

		$key=$this->getStateKeyPrefix().$key;

		return isset($_SESSION[$key]) ? $_SESSION[$key] : $defaultValue;

	}



Quick tip: If u do not understand some functions that how it works and what does, take a look from the code all time. That why it is open course an we love it.

Great! As a newbie, looking at source code sounds scary, but I appreciate your tip! Thank you!