ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:session:reference:adodb_unserialize

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
v5:session:reference:adodb_unserialize [2016/05/21 15:25] – created mnewnhamv5:session:reference:adodb_unserialize [2018/07/01 22:04] (current) – typo in class name peterdd
Line 1: Line 1:
-====== adodb_session_unserialize======+====== adodb_unserialize======
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box> <WRAP right box>
 ==Syntax== ==Syntax==
-  bool ADOdb_Session::debug+  array adodb_unserialize
-    optional bool $enableDebugger+    string $sessionData
     )     )
 </WRAP> </WRAP>
 ===== Description ======= ===== Description =======
-The **static** method debug enables or disables debugging on the session connectionThis is not the same value as the debugging associated with the database abstraction layer debugging.+The method unpacks the data stored in the session field in the session data table and converts it to an arrayThe data stored in the field is similar, but not quite a serialized array. Under certain circumstances the PHP function [[http://php.net/manual/en/function.unserialize.php|unserialize()]] will work but you should not rely on it.
    
-=====Use As A Getter===== 
-When used without parameters it returns the currently set value 
 =====Usage===== =====Usage=====
 <code php> <code php>
Line 19: Line 17:
 include_once "adodb/session/adodb-session2.php"; include_once "adodb/session/adodb-session2.php";
  
-ADODB_session::config($driver,$host,$user,$pass,$database); +ADODB_Session::config($driver,$host,$user,$pass,$database); 
-ADOdb_session::debug(true);+ 
 +$_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' 
 +         ) 
 +
 +*/
  
 </code> </code>
v5/session/reference/adodb_unserialize.1463837143.txt.gz · Last modified: 2017/04/21 11:38 (external edit)