PHP: Joomla get username and email

PHP: Joomla get username and email
<?
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );

//JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : null;

/**
* CREATE THE APPLICATION
*
* NOTE :
*/
$mainframe =& JFactory::getApplication('site');



$user =& JFactory::getUser();

echo $user->username;

echo "<p>Your name is {$user->name}, your email is {$user->email}, and your username is {$user->username}</p>";
  echo "<p>Your usertype is {$user->usertype} which has a group id of {$user->gid}.</p>";
  
?>

你可能感兴趣的:(PHP: Joomla get username and email)