简体   繁体   English

如何获取当前的Joomla用户名?

[英]How to get the current Joomla username?

I'm trying to get the current Joomla username. 我正在尝试获取当前的Joomla用户名。 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. 但是现在我已经在本地服务器上安装了Joomla,它不再起作用了。 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; ?> <? echo "wellcome ". $user->username; ?>

That is the correct way to get the username from Joomla. 这是从Joomla获取用户名的正确方法。 If that isn't working, then you have a bigger problem somewhere. 如果这不起作用,那么您在某个地方遇到了更大的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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