1. Go to this page and download the library: Download folded/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/ */
folded / session example snippets
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
// ...
use function Folded\setSession;
setSession("token", "12345");
use function Folded\setSession;
use function Folded\getSession;
setSession("token", "12345");
echo getSession("token"); // "12345"
use function Folded\hasSession;
if (hasSession("token")) {
echo "has token in session";
} else {
echo "has not token in session yet";
}
use function Folded\flashSession;
use function Folded\getSession;
use function Folded\hasSession;
flashSession("token", "12345");
echo getSession("token"); // "12345"
var_dump(hasSession("token")); // bool(false)
use function Folded\getSession;
use function Folded\flashSession;
use function Folded\hasSession;
flashSession("token", "12345");
getSession("token", $keep = true);
var_dump(hasSession("token")); // bool(true)
use function Folded\hasSession;
use function Folded\removeSession;
use function Folded\setSession;
setSession("token", "12345");
var_dump(hasSession("token")); // booll(true)
removeSession("token");
var_dump(hasSession("token")); // bool(false)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.