PHP code example of okneloper / session
1. Go to this page and download the library: Download okneloper/session library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
okneloper / session example snippets
use Okneloper\Session\Session;
// optional
Session::setDefaultNamespace('My Namespace');
// Start the session if necessay and Iniitialize a session object
$session = Session::newInstance();
$session->username = 'admin';
$session->foo = array('bar', 'baz');
print_r($_SESSION);
$session1 = Session::newInstance('admin');
$session1->username = 'johndoe';
$session1->role = 'manager';
$session2 = Session::newInstance('profile');
$session2->username = 'the_master';
$session2->timestamp = time();
print_r($_SESSION);