Yii Framework Forum: Unstable Getstate Function Result When Call Setstate/set Session More Then 1 Time - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Unstable Getstate Function Result When Call Setstate/set Session More Then 1 Time Rate Topic: -----

#1 User is offline   synyster 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 29-November 12

Posted 29 November 2012 - 11:08 PM

For Example, i have session 'globalunit', and i want to set that session value use setState function. so i make actionSetUnit and actionGetUnit function in my Controller class to be called in my View class by ajax
 //to set globalunit
 public function actionSetUnit(){
   Yii::app()->user->setState('globalunit',$_POST['unit']);
 }

 //to get globalunit
 public function actionGetUnit(){
    echo Yii::app()->user->getState('globalunit');
 }

i often call actionSetUnit in my view, when i change/click my combo unit in my view. but when i call getUnit function in my view to show globalunit value, the result/respons unstable. sometime the respons is true according the last unit i choose in combo Unit. sometime the respons is false (not change according the value of the last unit i choose in combo unit) :(...
Maybe i too much call setState function to set value session with same name.
any missing in my code??
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users