繁体   English   中英

Codeigniter会话信息

[英]Codeigniter Session information

CodeIgniter用于在数据库上存储会话值的模式是什么? 我以为这只是CodeIgniter的一种存储方式,但我只是发现了另一个使用相同模式的PHP projet(不使用CI)。

a:11:
{
s:10:"usuario_id";
s:1:"1";
s:13:"usuario_login";
s:5:"admin";
s:13:"usuario_senha";
s:40:"8cb2237d0679ca88db6464eac60da96345513964";
s:12:"usuario_nome";
s:13:"Administrador";
s:13:"usuario_email";
s:26:"desenvolvedor.01@gmail.com";
s:18:"usuario_registrado";
s:19:"2011-05-06 16:25:33";
s:13:"usuario_chave";
s:0:"";
s:14:"usuario_status";
s:1:"1";
s:14:"usuario_logado";

b:1;
s:8:"setor_id";
s:6:"images";
s:12:"setor_numero";
s:3:"017";
}

这就是在PHP上调用serialize时发生的情况。

序列化文档:

生成值的可存储表示

这对于存储或传递PHP值而不丢失其类型和结构很有用。

要将序列化的字符串再次转换为PHP值,请使用unserialize ()。

注意,“可存储”在这里表示“字符串”(我相信在所有情况下)

为了更好地了解其中的内容:

a:11: // <-- array has 11 keys (this will alternate key/value
{
s:10:"usuario_id"; // <-- string 10 characters long which is the first key
s:1:"1"; // <-- string 1 character long which represents the first value
s:13:"usuario_login"; // <-- string 13 characters long (second key)
s:5:"admin";// <-- string 5 characters long (second value)
// yada yada
s:14:"usuario_logado";
b:1; // <-- boolean TRUE
// yada yada
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM