1. Go to this page and download the library: Download phputil/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/ */
phputil / session example snippets
$session = new phputil\FileBasedSession();
$session->start();
$session->put( 'user_name', $_POST[ 'user_name' ] ); // Set a value in the session
echo 'Hello, ', $session->get( 'user_name' ); // Get a value from the session
$session = new phputil\FileBasedSession();
$session->setName( 'myapp' ); // (optional) "PHPSESSID" session cookie key becomes "myapp"
$session->setCookieParams( $lastOneDay = 60 * 60 * 24 ); // (optional) cookie will last one day
$session->start();
$session = new phputil\FileBasedSession();
$session->start();
$savedId = $session->id();
$session->close();
// Opening another session
$session->id( $_GET[ 'another_id' ] );
$session->start(); // starts the session with id "another_id"
...
$session->close();
// Restoring the session with "savedId"
$session->id( $savedId );
$session->start();
$session = new phputil\FileBasedSession();
$session->start();
$session->regenerateId( true ); // true means delete the old file
$session = new phputil\FileBasedSession();
$session->start();
$session->destroy();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.