Search code examples
phpcodeignitercodeigniter-3

how i can access session in route.php in codeigniter 3.0


how i can access session in route.php in codeigniter 3.0

my application is multi language support so i can used session for language change my application data , lable,static captions language change

now i want to extend my application

means when language change that time url also change means

for example

http://localhost/test/en/controller/method

when change language in spainsh that time url change like below

http://localhost/test/es/controller/method

so how i can do this

please help me thanks


Solution

  • You always can access to the $_SESSION variable. However, I'm not sure if it's compatible with CodeIgniter Session library.

    session_start();
    
    if(isset($_SESSION['lang']))
    {
       // define your routing here
    }