Yii Framework Forum: CWebUser::getState return nothing when using browser back button - Yii Framework Forum

Jump to content

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

CWebUser::getState return nothing when using browser back button Rate Topic: -----

#1 User is offline   chlind 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 25-December 17

Posted 25 December 2017 - 10:37 PM

This is the code of my first page:

public function actionTest()
{
    echo "<a href='test2'>Test</a>";
    $test = Yii::app()->user->getState('my123test');
    echo "<pre>".print_r($test,true)."</pre>";
}


In the second page:

public function actionTest2()
{
    Yii::app()->user->setState('my123test', array("omg" => time()));
}


After clicking "Test" in the first page, I click back button on my browser (I'm using newest chrome). It should be showing timestamp at the first page, but it's not. It shows the timestamp when I refresh the first page. When I'm testing the code in another apache server, the first page does show a timestamp without refreshing. So my question is why CWebUser::getState return nothing when using back button in some apache servers? Thanks in advance.
0

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,533
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 26 December 2017 - 12:42 AM

its likely your browser is serving the page from cache
1

#3 User is offline   chlind 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 25-December 17

Posted 26 December 2017 - 12:47 AM

View Postalrazi, on 26 December 2017 - 12:42 AM, said:

its likely your browser is serving the page from cache


I'm using the same browser when testing the code on two apache server. One return nothing, the other returns correct state value.
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