将Joomla 2.5 DB用户发送到Ajax JSON

时间:2018-10-24 08:05:49

标签: php json ajax joomla

我写了这个文件来检索登录的用户名。

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"}

我该怎么做?

0 个答案:

没有答案