简体   繁体   中英

How to get the current Joomla username?

I'm trying to get the current Joomla username. I was able to get it by using

$user =& JFactory::getUser();
echo $user->username;

But now I've installed Joomla on my local server and it doesn't work anymore. The usernames are correctly stored in the database, but the code just doesn't work anymore. Any ideas?

Thanks

use only : <? echo "wellcome ". $user->username; ?> <? echo "wellcome ". $user->username; ?>

That is the correct way to get the username from Joomla. If that isn't working, then you have a bigger problem somewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM