反序列化PHP会话数据 [英] Unserialize PHP session data
本文介绍了反序列化PHP会话数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用CodeIgniter 3.x与数据库会话驱动程序,我想访问数据
cloumn BLOB
类型。这里我的blob数据:
I'm using CodeIgniter 3.x with database session driver and i want to access data
cloumn that BLOB
type. Here my blob data:
__ci_last_regenerate|i:1435420891;identity|s:13:"john@doe.com ";username|s:13:"johndoe";email|s:13:"john@doe.com ";user_id|s:1:"5";old_last_login|s:10:"1435412865";
我尝试使用 unserialize($ string)
但是没有工作!
unserialize():在偏移0处出错
unserialize(): Error at offset 0
如何访问blob数据元素?例如: $ user ['email']
How can i access blob data element? For ex: $user['email']
推荐答案
这里的解决方案
所以我使用了会话解码 http:// php .net / session_decode
So I have used session decode http://php.net/session_decode
session_decode('__ci_last_regenerate|i:1446535049;ci_UserID|s:1:"2";ci_UserName|s:24:"example@xyz.com";logged_in|b:1;');
因此会话解码在正常的php会话中存储所有加密的数据。
So session decode stored all the encrypted data in normal php session.
我可以使用:
echo $_SESSION['ci_UserID'];
这篇关于反序列化PHP会话数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文