English 中文(简体)
用户代码
原标题:Codeigniter Current Logged in user

在编码协调员中,我有一份标识/登记表,全部建立起来,完美地工作,然而,我如何产生目前用户的名称,即用户名称。 当用户贴上“Welcome,[用户名称]”栏。

我也有必要知道这一点,以便能够从数据库中产生基于目前用户信息数据库的记录,我如何能够这样做? 我把关于密码用户的文献汇编成册,但却发现我所期待的东西。 I m 采用积极记录。

增 编

最佳回答
echo $this->session->userdata( name )

将这些资料纳入db选择档案,例如,如果你有文件证明,如果你在记录时想要显示,则将会议数据作为在db中点。

我建议你将本届会议的所有数据输入数据库,如届会类别所示。

http://codeigniter.com/user_guide/libraries/sessions.html

问题回答

How is your login form performing the login action ? In most cases it s using session to identify that you are logged in. After you confirm (usually with database) that a user is OK drop user info in session (ID, readable name, and any other things you need) and next:

echo "Welcome " . $_SESSION["username"];




相关问题
Codeigniter WHERE on "AS" field

I have a query where I need to modify the selected data and I want to limit my results of that data. For instance: SELECT table_id, radians( 25 ) AS rad FROM test_table WHERE rad < 5 ORDER BY rad ...

Problem find joined table in rails

I have model represent association rule (Body => Head) def Item has_many :heads has_many :bodies ... end def Rule has_many :heads has_many :bodies ... end def Body belongs_to :item belongs_to :rule ...

FreeTDS Bad token from the server (SQL Server)

Today we had a lot more activity than normal between our Ruby on Rails application and our remote legacy SQL Server 2005 database, and we started getting the error below intermittently. What is is? ...

Castle ActiveRecord: one-to-one

While playing around with one-to-one associations in castle activerecord I stumbled upon the following problem: I m trying to model a one-to-one relationship (user-userprofile in this case). I ...

Sending email updates: model or observer?

I have an Event model, which stores an event feed for each user. I also need to email the updates to users which have enabled email notifications in their profile. From an architectural point of view,...

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

热门标签