Differences in session variable declaration |
Hi, I have the following hook
PHP Code: class LanguageLoader With the line PHP Code: $site_lang = $_SESSION['site_lang']; PHP Code: A PHP Error was encountered but replacing it with PHP Code: $site_lang = $ci->session->site_lang;
When using:
PHP Code: $CI =& get_instance(); Your getting CodeIgniter's Controller Class. Are you loading the Session library in the Controller or are you Autoloading it? What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-12-2018, 02:22 PM)php_rocs Wrote: @n2fole00 They both return the same thing. The error occurs when the value is NULL.
Then use isset method on it to see if it contains a value or not.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-13-2018, 07:51 AM)php_rocs Wrote: @n2fole00, This is what I was thinking, but what could be the difference? var_dump should give me the output isset would test for. (09-13-2018, 02:08 PM)php_rocs Wrote: @n2fole00, PHP Code: $site_lang2 = $_SESSION['site_lang']; Code: site_lang: NULL site_lang2: NULL isset: bool(false) |
Welcome Guest, Not a member yet? Register Sign In |