- 很久很久以前学习Codeigniter的笔记记录,很随意,但都是自己记录的,希望对需要的人有所帮助。
- 本文使用word2013编辑并发布
- Postbird | There I am , in the world more exciting!
-
Postbird personal website : http://www.ptbird.cn
session
CI中的session是存在cookie中的
1、session数据的存储
$this->session->set_userdata('user',$user);
user是key
$data是值
2、不获取刚设置的数据
只有页面重新加载后,跳转到别的控制器或者url中才能获取到
3、错误处理
In order to use the Session class you are required to set an encryption key in your config file.
进行配置
1) 生成一个随机不重复的串 echo md5(uniqid());
2) 修改配置文件 $config['encryption_key']
4、配置
其中 $config['sess_encrypt_cookie'] = TRUE会再加一层加密
5、flash数据/一次性数据
//只能读取一次
//再次刷新就没了