php-session-serializer
Appearance
php-session-serializer is a PHP library that provides methods that work like PHP's session_encode
and session_decode
functions but don't mess with the $_SESSION
superglobal.
使用法
use Wikimedia\PhpSessionSerializer;
// (省略可能) Send logs to a PSR-3 logger
PhpSessionSerializer::setLogger( $logger );
// (省略可能) Ensure that session.serialize_handler is set to a usable value
PhpSessionSerializer::setSerializeHandler();
// Encode session data
$string = PhpSessionSerializer::encode( $array );
// Decode session data
$array = PhpSessionSerializer::decode( $string );