我在Joomla 2.5.16,我想要當前的用戶ID和組ID。獲取Joomla用戶ID返回空白頁
以下代碼返回空白頁面,爲什麼?
<?php
include_once $_SERVER['DOCUMENT_ROOT']."/includes/defines.php";
include_once $_SERVER['DOCUMENT_ROOT']."/includes/framework.php";
$user = JFactory::getUser();
$group_id = &JFactory::group_id();
$user_id = $user->get('id');
echo $user_id;
echo $group_id;
?>
是錯誤報告被激活?測試輸出是否顯示任何內容? –
錯誤報告設置爲最大值 –
現在,將此代碼添加爲模塊將返回錯誤:致命錯誤:調用未定義的方法JFactory :: group_id()in .. on line 9 –