PHP code example of feeh27 / session-encoder-decoder
1. Go to this page and download the library: Download feeh27/session-encoder-decoder 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/ */
feeh27 / session-encoder-decoder example snippets
$session = new SessionEncoderDecoder\PSR7Session();
$decodedData = [
'user_id' => '389',
'profile_id' => 27,
];
$encodedData = $session->encode($decodedData);
echo $encodedData; // 'user_id|s:3:"389";profile_id|i:27;'
$encodedData = 'user_id|s:3:"389";profile_id|i:27;';
$decodedData = $session->encode($encodedData);
print_r($decodedData);
// Array
// (
// [user_id] => 389
// [profile_id] => 27
// )