最近遇到個magento後臺登錄不了的問題,但是經過排查後臺用戶名和密碼都是正確的,但是就是登錄不了後臺。我勒個去,糾結……也不報錯,最後終於找到解決的辦法瞭如下
解決方法如下:(注意大小寫哦)
打開文件 app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
找到代碼:
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly() );
替換爲:
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath() ,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly() );
但是還有的這樣設置過後仍登陸不了後臺
magento1.4.1安裝完後登錄不了後臺,但是密碼和用戶名都是正確的,解決方法:
打開 app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
找到下面的代碼
註釋掉$cookieParams['domain'] = $cookie->getDomain();這行,就行了。
if (isset($cookieParams['domain'])) {
//$cookieParams['domain'] = $cookie->getDomain();
}
但是按照這個去做之後,還是出現錯誤,於是我把下面這段全部註釋掉
//if (isset($cookieParams['domain'])) {
//$cookieParams['domain'] = $cookie->getDomain();
// }
搞定,現在所有版本magento登陸不了後臺的問題都解決了
或者把
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}
//call_user_func_array('session_set_cookie_params', $cookieParams);
或者把這一行註釋掉,大概在104行.更改這個之後絕對可以登錄後臺,我已經親自測試過。
改過後可以登錄後臺了,然後在去改下面這個,把值改下,在還原上面註釋的文件,去登錄試試,如果可以登錄就好,如果還是不行,那只有在去註釋掉了
在 System—Configuration-Web-Session Cookie management....timeout 改爲:86400