简体   繁体   English

Codeigniter会话信息

[英]Codeigniter Session information

What is the pattern used by CodeIgniter to store session values on the database? CodeIgniter用于在数据库上存储会话值的模式是什么? I thought it was only a CodeIgniter way to store it but I just found another PHP projet (not using CI) that uses the same pattern. 我以为这只是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";
}

That is what happens when you call serialize on something in PHP. 这就是在PHP上调用serialize时发生的情况。

Serialize documentation: 序列化文档:

Generates a storable representation of a value 生成值的可存储表示

This is useful for storing or passing PHP values around without losing their type and structure. 这对于存储或传递PHP值而不丢失其类型和结构很有用。

To make the serialized string into a PHP value again, use unserialize (). 要将序列化的字符串再次转换为PHP值,请使用unserialize ()。

As a note, "storable", here, means "String" (I believe in all cases) 注意,“可存储”在这里表示“字符串”(我相信在所有情况下)

To get a better idea as to what's in there: 为了更好地了解其中的内容:

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