php - Yii session resetting on redirect -


I have the following code to identify a session for language_id or session if $ $ _GET varaiable has been passed Set init ();

  The address of the private function (language) if (isset ($ _GET ['language_code']) & amp; down ($ _GET ['language_code'])) {$ language = Language :: model () - & gt; Find (array ('condition' = & gt; 'Iso_code =: iso_code', 'params' => array (': iso_code' = & gt; $ _GET ['language_code']),)); If ($ language! = Null) {Yii: app () -> session ['language_id'] = $ language-> Id; $ This- & gt; Redirect (Yii :: app () - & gt; Request & gt; urlReferrer); } And {$ this- & gt; Redirect (Yii :: app () - & gt; request- & gt; url referrer); }} And {$ currentLang = (isset (Yii: app () -> session ['language_id']))? Yii :: app () - & gt; Session ['language_id']: 1; If (Language :: model () - & gt; find (array ('condition' = & gt; "id =: id and country_ id =: country_id", 'params' = & gt; array (': id' = & Gt; $ currentLang, 'country_id' => $ - this- & gt; country_details ['id']))) $ currentLang; } Else {Yii :: app () -> session ['language_id'] = 1; Return 1; }}}  

When I go to URL ... ... language_code = ru, it sets the session successfully and redirects the referrer URL, but when I refresh the page , Then it resets.

I do not understand, as far as I can see, my argument is fine in this function.

EDIT: Efforts have also been made with cookies and there are no other sessions that are interacting with these sessions which may be the difference.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -