PHP code example of micheledef / pdo-session-handler

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

    

micheledef / pdo-session-handler example snippets

sh


heledef\PdoSessionHandler\PDOSessionHandler;

$username = "username";
$password = "password";
$databasename = "databasename";

$pdo = new PDO(
    "mysql:dbname=$databasename;host=localhost;",
    $username,
    $password
);
session_set_save_handler(new PDOSessionHandler($pdo));
sh


session_start();