Yii中的Yii :: app()-> user-> setState吗? [英] Yii::app()->user->setState in yii?
问题描述
我想在yii中了解这一点:
Yii::app()->user->setState('key','value');
如果我有一个大小为10的数组,并且将该数组设置为以下状态:
Yii::app()->user->setState('data',$dataArray)
我还有另一个大小为15000的数组,并将该数组设置为如下状态:
Yii::app()->user->setState('data',$dataArray)
可以吗?
或者这会影响我的Yii项目的速度,即setState数据大小越大,yii项目的速度就越慢吗?
在Yii::app()->user->setState('password',$password)
中设置密码之类的机密数据是否安全?
由于安全问题,请勿将密码存储在setState中,但是如果需要,则可以使用一些加密方法.
您可以在此处看到setState函数正在使用会话 http://www.yiiframework.com/doc/api/1.1/CWebUser#setState-detail
您可以在会话中存储任意数量的数据.所有会话都存储在服务器上.会话的大小没有限制,但是PHP可以占用的内存有限制:可以在其中保存很多信息吗$ _SESSION?
谢谢
I want to know about this in yii:
Yii::app()->user->setState('key','value');
If I have a array of size 10 and I set this array in state like:
Yii::app()->user->setState('data',$dataArray)
I have another array of size 15000 and I set this array in state like:
Yii::app()->user->setState('data',$dataArray)
Is this Ok?
Or It will effect the speed of my Yii project i.e. larger the setState data size ,slower will be the speed of yii project?
Is it is secure way for confidential data like Password to set in Yii::app()->user->setState('password',$password)
?
Don't store the password in the setState due to security issue variables but if you need than use some encryption .
You can see here that the setState function is using the the session http://www.yiiframework.com/doc/api/1.1/CWebUser#setState-detail
You can store as much data as you like within in sessions. All sessions are stored on the server.There is no limit to the size of the session, But there is a limit to the memory PHP can take: http://ca.php.net/manual/en/ini.core.php#ini.memory-limit
Another very informative link regarding large data in session is
Is it okay to save lots of information in $_SESSION?
Thanks
这篇关于Yii中的Yii :: app()-> user-> setState吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!