在另一个php文件中使用joomla登录的用户数据
我是乔姆拉的新手。我希望在我的php文件中使用登录的joomla用户信息。我使用以下代码来执行此操作: 在下面的代码中,我希望回显登录的用户名:在另一个php文件中使用joomla登录的用户数据,php,joomla,joomla2.5,Php,Joomla,Joomla2.5,我是乔姆拉的新手。我希望在我的php文件中使用登录的joomla用户信息。我使用以下代码来执行此操作: 在下面的代码中,我希望回显登录的用户名: define( '_JEXEC', 1 ); define( 'JPATH_BASE', "/wamp/www/joomla" ); define( 'DS', '/' ); require_once ( 'includes'.DS.'defines.php' ); require_once ( 'includes'.DS.'framework.ph
define( '_JEXEC', 1 );
define( 'JPATH_BASE', "/wamp/www/joomla" );
define( 'DS', '/' );
require_once ( 'includes'.DS.'defines.php' );
require_once ( 'includes'.DS.'framework.php' );
require_once ( 'libraries'.DS.'joomla'.DS.'factory.php' );
$mainframe =& JFactory::getApplication('site');
$theUser =&JFactory::getUser();
echo $theUser;
但当我执行此操作时,出现以下错误:
SCREAM: Error suppression ignored for
( ! ) Strict standards: Only variables should be assigned by reference in C:\wamp\www\joomla\chklogintest.php on line 9
导致错误的第9行是:
$mainframe =& JFactory::getApplication('site');
有人能帮我吗?我怎样才能解决这个问题?谢谢…您应该删除所有的“&”字符,PHP中不推荐使用引用分配的变量。您可以阅读manuel页面了解更多信息:
如果升级php版本,可能会引发致命错误,请小心