File: demos/test.php

Recommend this page to a friend!
  Classes of Francesco Danti  >  ATK4 Session  >  demos/test.php  >  Download  
File: demos/test.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ATK4 Session
Store and retrieve PHP session data in a database
Author: By
Last change:
Date: 1 year ago
Size: 526 bytes
 

 

Contents

Class file image Download
<?php

declare(strict_types=1);

include
__DIR__.'/../vendor/autoload.php';

$p = new \atk4\data\Persistence_SQL('mysql:dbname=atk4;host=localhost', 'atk4', '');

// create the table in database using schema\Migration
// use it one time to creqate the table, don't migrate on every call, please leave mysql alone ;)
(new \atk4\schema\Migration\MySQL(new \atk4\ATK4DBSession\SessionModel($p)))->migrate();

// init SessionHandler
new \atk4\ATK4DBSession\SessionHandler($p);

print_r($_SESSION['test']);

$_SESSION['test'] = 1;


For more information send a message to info at phpclasses dot org.