在codeigniter中包含會話中的所有用戶詳細信息是否合適?

[英]Is it good to include all the user details in the session in codeigniter?


I'm currently doing a code-igniter project and its based on student management system.I stored user id as

我目前正在做一個代碼點火器項目,它基於學生管理系統。我將用戶ID存儲為

$session_id = $this->session->userdata('u_id');

$ session_id = $ this-> session-> userdata('u_id');

I'm planning to use a model function and get the other details of the currently logged user through this session_id.I'm using mysql as the database.my web application will used by more than 20,000 users. Is there a performance difference in calling a model function everywhere when compared to declaring all the user details in the session array in codeigniter?

我打算使用模型函數並通過此session_id獲取當前登錄用戶的其他詳細信息。我使用mysql作為database.my Web應用程序將被超過20,000個用戶使用。與在codeigniter中聲明會話數組中的所有用戶詳細信息相比,在任何地方調用模型函數是否存在性能差異?

1 个解决方案

#1


0  

Your question seems different from what I read in the title so I will awnser both.

你的問題似乎與我在標題中看到的有所不同,所以我會兩個都不同。

Is it good to include all the user details in the session in codeigniter?:

在codeigniter中包含會話中的所有用戶詳細信息是否合適?:

No, it's not good to hold all the user data in a session. Only hold data that is neccecary to hold on to (Such as just a user ID would be enough), though in my personal opinion I'd also encrypt the data. Just for safety's sake.

不,將所有用戶數據保存在會話中並不好。只保存需要保留的數據(例如只需用戶ID就足夠了),但我個人認為我也會對數據進行加密。為了安全起見。

Besides that, there is nothing wrong with calling a function to grab all the other data. It's what you'd need to do. You don't want your users to hold all their own data for no reason.

除此之外,調用函數來獲取所有其他數據也沒有錯。這是你需要做的。您不希望您的用戶無緣無故地擁有自己的所有數據。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/01/31/729d8994002477cc2e130a50e46bb292.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com