PHP code example of pyrsmk / session

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

    

pyrsmk / session example snippets


// Create the session object
$session = new Session();
// Define a session variable
$session['user_id'] = $user_id;
// Print a previously defined session variable
echo $session['user_id'];
// Remove a variable
unset($session['user_id']);

$session = new Session('my_namespace');