Php Joomla 2.5-函数getLanguage不';我不说现在的语言

Php Joomla 2.5-函数getLanguage不';我不说现在的语言,php,joomla,joomla2.5,Php,Joomla,Joomla2.5,我尝试获取当前选定的语言 以下是我的代码部分: define('_JEXEC', 1); define('DS', DIRECTORY_SEPARATOR); if (file_exists(dirname(__FILE__) . '/defines.php')) { include_once dirname(__FILE__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirn

我尝试获取当前选定的语言

以下是我的代码部分:

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';

$lang =& JFactory::getLanguage()->getTag();
而且

echo $lang;
始终返回en GB

该网站可以使用Ger和Eng。它还可以更改不同文章的语言。我不明白为什么我没有在php中获得当前选择的语言。

超出了范围

以下是解决方案:

// Set flag that this is a parent file.
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';


// Instantiate the application.
$app = JFactory::getApplication('site');

// Initialise the application.
$app->initialise();


$lang =& JFactory::getLanguage()->getTag();

我建议你试着问一下你的问题,因为它会在那里得到更多的关注。谢谢,我会在那里试一下。