CodeIgniter Forums
Native session in CI 3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Native session in CI 3 (/showthread.php?tid=64920)



Native session in CI 3 - anyamanggar - 04-11-2016

Hello guys,
I want to ask , why native session can not be used in CI 3. erornya like this

PHP Code:
A session had already been started ignoring session_start() 

what should i have to doit if i want use native, my script like this

PHP Code:
<?php 
// print_r($_SESSION);
 
$_SESSION['username'] = $this->session->userdata('nama');
$usr $_SESSION['username']; // Must be already set
session_start();
$_SESSION['username'] = $usr;

// echo $_SESSION['username'];
?>



RE: Native session in CI 3 - albertleao - 04-11-2016

If you initialize the session library, there should be no reason for you to use session_start() again.

http://www.codeigniter.com/user_guide/libraries/sessions.html#what-is-session-data