我正在開發基於CakePHP的Web應用程序。cakePHP「會話」沒有返回會話ID
這裏是我core.php中設置會話處理
Configure::write('Session.save', 'database');
/**
* The name of the table used to store CakePHP database sessions.
*
* 'Session.save' must be set to 'database' in order to utilize this constant.
*
* The table name set here should *not* include any table prefix defined elsewhere.
*/
Configure::write('Session.table', 'cake_sessions');
/**
* The DATABASE_CONFIG::$var to use for database session handling.
*
* 'Session.save' must be set to 'database' in order to utilize this constant.
*/
//Configure::write('Session.database', 'default');
Configure::write('Session.start', true);
/**
* The name of CakePHP's session cookie.
*/
Configure::write('Session.cookie', 'CAKEPHP');
/**
* Session time out time (in seconds).
* Actual value depends on 'Security.level' setting.
*/
Configure::write('Session.timeout', '300');
/**
* If set to false, sessions are not automatically started.
*/
Configure::write('Session.start', true);
/**
* When set to false, HTTP_USER_AGENT will not be checked
* in the session
*/
Configure::write('Session.checkAgent', true);
/**
* The level of CakePHP security. The session timeout time defined
* in 'Session.timeout' is multiplied according to the settings here.
* Valid values:
*
* 'high' Session timeout in 'Session.timeout' x 10
* 'medium' Session timeout in 'Session.timeout' x 100
* 'low' Session timeout in 'Session.timeout' x 300
*
* CakePHP session IDs are also regenerated between requests if
* 'Security.level' is set to 'high'.
CakePHP的會話ID始終是空白。雖然其他會話讀/寫活動工作得很好。
以下是會話對象。
SessionComponent Object
(
[__active] => 1
[__started] =>
[__bare] => 0
[valid] =>
[error] => Array
(
[2] => Auth.redirect doesn't exist
)
[_userAgent] => 2abebfb51fc971ec64569f7cd415fe0b
[path] =>/
[lastError] => 2
[security] => high
[time] => 1278950154
[sessionTime] => 1278953154
[watchKeys] => Array
(
)
[id] =>
[_log] =>
[host] =>localhost
[enabled] => 1
[cookieLifeTime] => 0
)
所有其他會話變量都存儲和檢索得當,問題是我沒有得到任何階段的會話ID。
你能幫我解答一下問題。
感謝, Sourabh
什麼是你想與你的會話ID做啓動會話?你使用它的動機是什麼? – mikegreenberg 2010-07-12 16:26:57
我想要做的是將會話ID和某個安全令牌發佈到cakePHP操作,並使用會話ID檢索會話信息並驗證安全令牌。 – Sourabh 2010-07-12 16:39:34
您是否嘗試過使用其他會話存儲類型之一來查看它是否特定於「DB」會話?我猜你還使用Cake CLI創建了會話數據庫表格模式?此外,這有沒有正常工作?如果是這樣,那麼在破產之前你最後採取了哪些措施? – mikegreenberg 2010-07-12 18:58:08