php - 如何从数据库反序列化 codeigniter session 数据

标签 php codeigniter

我想在外部脚本中使用 CI session ,并且我从数据库中获取了以下数据。

 __ci_last_regenerate|i:1446535049;ci_UserID|s:1:"2";ci_UserName|s:24:"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="06637e676b766a63467e7f7c2865696b" rel="noreferrer noopener nofollow">[email protected]</a>";logged_in|b:1;

我已经尝试过unserializeunserialize(base64_decode($data))但我还失败。

请帮助提取此数据。

最佳答案

我得到了解决方案here

所以我用了session decode

session_decode('__ci_last_regenerate|i:1446535049;ci_UserID|s:1:"2";ci_UserName|s:24:"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="45203d2428352920053d3c3f6b262a28" rel="noreferrer noopener nofollow">[email protected]</a>";logged_in|b:1;');

因此 session 解码存储了正常 php session 中的所有加密数据。

我可以使用以下方式访问:echo $_SESSION['ci_UserID'];

谢谢大家的帮助

关于php - 如何从数据库反序列化 codeigniter session 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33494092/

相关文章:

database - 在应用程序的数据库端支持多种语言

php - 在 codeigniter 路由中使用通配符?

php - 如何在 codeigniter 中强制使用 ssl?

php - 如何使用php和mysql从一个表中搜索另一个表中是否存在记录

php - 键->值数据有哪些好的、快速的持久存储选项?

php - onclick 函数中的 If/Else 语句

php - Codeigniter 如何设置 API key 和资源 URL 以便在应用程序中轻松访问

PHP 代码设计、结构、模式..?

PHP 数组到 JavaScript

php - 我需要在最后一个日期匹配时显示提醒消息