ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:session:reference:adodb_unserialize

adodb_unserialize

Syntax
array adodb_unserialize(
  string $sessionData
  )

Description

The method unpacks the data stored in the session field in the session data table and converts it to an array. The data stored in the field is similar, but not quite a serialized array. Under certain circumstances the PHP function unserialize() will work but you should not rely on it.

Usage

 
include_once 'adodb/adodb.inc.php';
include_once "adodb/session/adodb-session2.php";
 
ADODB_Session::config($driver,$host,$user,$pass,$database);
 
$_SESSION['key1'] = 'value1';
$_SESSION['key2']['sub1'] = 'subvalue1';
$_SESSION['key2']['sub2'] = 'subvalue2';
 
$SQL = "SELECT sessdata FROM sessions2 WHERE sesskey = 'some-value'";
 
$sessdata = $db->getOne($SQL);
 
print_r(adodb_unserialize($sessdata));
 
/*
* Prints
Array(
   key1 => 'value1',
   key2 => Array(
         sub1 => 'subvalue1',
         sub2 => 'subvalue2'
         )
)
*/
v5/session/reference/adodb_unserialize.txt · Last modified: 2018/07/01 22:04 by peterdd