所以我使用Facebook的PHP SDK用於驗證我的用戶....覈對Facebook的PHP SDK與Zend框架
,我試圖註銷使用destroySession()
方法我的用戶base_facebook.php
這些都是在PHP SDK的base_facebook.php一些相關摘錄:https://github.com/facebook/php-sdk/blob/master/src/base_facebook.php
public function destroySession() {
$this->setAccessToken(null);
$this->user = 0;
$this->clearAllPersistentData();
}
protected function clearAllPersistentData() {
foreach (self::$kSupportedKeys as $key) {
$this->clearPersistentData($key);
}
}
protected function clearPersistentData($key) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to clearPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
unset($_SESSION[$session_var_name]);
}
,但每次我嘗試這樣做,Zend框架會抱怨
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()'
Zend_Session_Exception: session has already been started by session.auto-start or session_start()
我該如何解決我的Facebook會話而不觸發所有這些錯誤?
你有自己的班級擴展BaseFacebook嗎?或者你是否擴展Facebook類(反過來擴展了Facebook)? –
如果Zend拋出這個異常,你應該檢查代碼並尋找其他可能的session_start(),也許在flashMessenger中?順便說一下,這段代碼來自擴展FacebookBase的Facebook類。也許你應該考慮編寫自己的類來存儲會話中的facebook數據,但使用Zend會話機制? –