How to determine the session is defined or not for Yii::app()=>user?

i want use


Yii::app()->user->setState('name',$value);

but i want determine is the ‘name’ set first?

how?

Thanks!

http://www.yiiframework.com/doc/api/CWebUser#hasState-detail. hasState, {return} boolean, whether there is a state of the specified name.




Yii::app()->user->hasState('name');



thank you very much!