1
嗨,我讓我的應用程序,這是從一個Joomla應用程序的iframe投放並且獲得了從的Joomla會話的用戶的詳細信息,下面的錯誤信息:的Joomla工廠獲得用戶
警告:函數ini_set():會話處於活動狀態。你不能在這個時候 第45行上的ID更改會話 模塊的INI設置/home/sites/accstats.co.uk/public_html/libraries/joomla/session/handler/joomla.php :973
這是我使用的代碼,它一直適用於舊版本的joomla,我不是開發者(只是一個業餘愛好者),所以我不確定問題是什麼。
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', "/home/sites/accstats.co.uk/public_html/");
require_once (JPATH_BASE .DS.'includes'.DS.'defines.php');
require_once (JPATH_BASE .DS.'includes'.DS.'framework.php');
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$user = JFactory::getUser();
if($user->id)
// log in
{
$_SESSION["UserID"] = $user->get("username");
$groups = $user->get('groups');
$_SESSION["GroupID"] = reset($groups);
$_SESSION["UserName"] = $user->get("name");
if ($user->get('isRoot')) $_SESSION["AccessLevel"] = ACCESS_LEVEL_ADMINGROUP;
else $_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;
}
else
// log out
{
$_SESSION["UserID"] = "";
$_SESSION["AccessLevel"] = "";
$_SESSION["GroupID"] = "";
$_SESSION["UserName"] = "";
}
你檢查了session.autostart嗎? http://stackoverflow.com/questions/32814895/message-ini-set-a-session-is-active-you-cannot-change-the-session-modules和http://stackoverflow.com/questions/13539269/ errorexception-warning-ini-set-a-session-is-active-you-can-change-the-s?你使用的mod-spdy模塊http://stackoverflow.com/questions/13654848/php-warning-a-session-is-active-you-cannot-change-the-session-modules-ini-set?如果您在文件的開頭添加會話開始會發生什麼情況? –
首先,你不需要我們。 DS。在大多數情況下,因爲Windows不再有處理問題* nix斜線。但是第二個..它在我看來就像是你有一個雙斜線,因爲你在JPATH_BASE結尾處有一個斜線,然後在追加下一個段之前有一個'.DS.'。 – Elin