Codeigniter Current Login

In Codeigniter, I have a login / registration form, everything is configured, it works fine, however how can I display the username of the current user, that is, when the user is logged in, he would say "Welcome, [username]".

I also need to know this in order to be able to output a record from the database based on the current user ID, how can I do this? I looked through the documents on codeigniter, but could not find what I was looking for. I am using active recording.

thank

+3
source share
2 answers
echo $this->session->userdata('name')

db, , , , , db

, .

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

+5

? , . , ( ), , (, , ), :

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

Source: https://habr.com/ru/post/1783281/


All Articles