PHP code example of next / session

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

    

next / session example snippets


composer 

$sessionHandler = new \Next\Session\Handler\FileHandler();

$session = new \Next\Session\Session($sessionHandler);

$session->start(null); // 如果为null则创建id
$session->set('foo', 'bar');
$session->get('foo');
$session->save();
$session->close();

$sessionId = $session->getId();