我写了这个文件来检索登录的用户名。
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' );
require('libraries/joomla/factory.php');
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
$user->get('id');
echo 'User: ' . $user->username . '<br />';
现在,我必须使用Ajax和JSON发送$ user-> username
。
有效载荷:
POST https://xxxxx.com/auth {email: "user@test.com"}
我该怎么做?