PHP code example of iflamed / onesession

1. Go to this page and download the library: Download iflamed/onesession 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/ */

    

iflamed / onesession example snippets



eConfig = array(
	'config'=>array(
		array(
				'host'=>'127.0.0.1',
				'port'=>11211,
				'weight'=>10,
		),
	),
	'useMemcached'=>false,
);
$keyPrefix='localhost';
$storeClassName = 'MemcacheStore';
Onesession\HttpSession::init($storeClassName,$cacheConfig,$keyPrefix);
session_start();
$_SESSION['serialisation'] = 'should be in json';
if (!isset($_SESSION['a'])) {
	$_SESSION['a'] = 0;
}
$_SESSION['a']++;
var_dump($_SESSION);