ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v6:session:reference:adodb_unserialize

adodb_unserialize

The default configuration of V6 session management uses the standard PHP serialization method. Simply call unserialize() to unpack the data. This function is provided for legacy compatibility purposes only.

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'
         )
)
*/
v6/session/reference/adodb_unserialize.txt · Last modified: by 127.0.0.1