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.
Usage
use Wikimedia\PhpSessionSerializer;
// <translate nowrap><!--T:2--> (optional)</translate> <translate nowrap><!--T:3--> Send logs to a PSR-3 logger</translate>
PhpSessionSerializer::setLogger( $logger );
// <translate nowrap><!--T:4--> (optional)</translate> <translate nowrap><!--T:5--> Ensure that session.serialize_handler is set to a usable value</translate>
PhpSessionSerializer::setSerializeHandler();
// <translate nowrap><!--T:6--> Encode session data</translate>
$string = PhpSessionSerializer::encode( $array );
// <translate nowrap><!--T:7--> Decode session data</translate>
$array = PhpSessionSerializer::decode( $string );
External links
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.