"Invalid cookie path" 与 Zend\Session 当设置 cookie_path
"Invalid cookie path" with Zend\Session when setting cookie_path
我正在尝试将 cookie 路径设置为我的本地域:
$config = new \Zend\Session\Config\StandardConfig();
$config->setOptions(array(
'cookie_path' => '.jt.martyndev',
));
$sessionManager = new \Zend\Session\SessionManager($config);
\Zend\Session\Container::setDefaultManager($manager);
return new \Zend\Session\Container('jt_sso');
但是,我遇到了以下异常:
Type: Zend\Session\Exception\InvalidArgumentException
Message: Invalid cookie path
File: /var/www/jt_sso/vendor/zendframework/zend-session/src/Config/StandardConfig.php
Line: 439
为什么我的 cookie 域无效?没关系。我在其他应用程序中使用它非常好。
我认为您混淆了 cookie_path
和 cookie_domain
。 cookie_path
应设置为 cookie 有效的路径,例如/
(默认值)或类似 /questions/
的内容。 cookie_domain
是您设置的主机名。
我正在尝试将 cookie 路径设置为我的本地域:
$config = new \Zend\Session\Config\StandardConfig();
$config->setOptions(array(
'cookie_path' => '.jt.martyndev',
));
$sessionManager = new \Zend\Session\SessionManager($config);
\Zend\Session\Container::setDefaultManager($manager);
return new \Zend\Session\Container('jt_sso');
但是,我遇到了以下异常:
Type: Zend\Session\Exception\InvalidArgumentException
Message: Invalid cookie path
File: /var/www/jt_sso/vendor/zendframework/zend-session/src/Config/StandardConfig.php
Line: 439
为什么我的 cookie 域无效?没关系。我在其他应用程序中使用它非常好。
我认为您混淆了 cookie_path
和 cookie_domain
。 cookie_path
应设置为 cookie 有效的路径,例如/
(默认值)或类似 /questions/
的内容。 cookie_domain
是您设置的主机名。