Exemplo n.º 1
0
<?php

// load file
require_once '../src/Session.php';
// use namespace
use thom855j\PHPSecurity\Session;
/*
 * Init session (session start and check if session is already set
 */
Session::init();
/*
 * Checks if session exists
 */
$name = 'example';
if (Session::exists($name)) {
    echo 'yes';
} else {
    echo 'no';
}
/*
 * Set a session by key and value
 */
$key = 'example';
$value = 'I Love PHP';
Session::set($key, $value);
/*
 * Adds a value as a new array element to the key.
 * useful for collecting error messages etc
 */
$key = 'example';
$value = 'I Love PHP';