CWebUser::getState return nothing when using browser back button

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.

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.