本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\Storage\MetadataBag::stampNew方法的典型用法代码示例。如果您正苦于以下问题:PHP MetadataBag::stampNew方法的具体用法?PHP MetadataBag::stampNew怎么用?PHP MetadataBag::stampNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
的用法示例。
在下文中一共展示了MetadataBag::stampNew方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (!$this->started) {
$this->start();
}
$this->metadataBag->stampNew($lifetime);
$this->id = $this->generateId();
return true;
}
示例2: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
return session_regenerate_id($destroy);
}
示例3: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$isRegenerated = session_regenerate_id($destroy);
// The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
// @see https://bugs.php.net/bug.php?id=70013
$this->loadSession();
return $isRegenerated;
}
示例4: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (!$this->started) {
$this->start();
}
if ($lifetime !== null) {
$this->options['cookie_lifetime'] = $lifetime;
}
if ($destroy) {
$this->metadataBag->stampNew($lifetime);
$this->handler->destroy($this->id);
}
$this->id = $this->generator->generateId();
return true;
}
示例5: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$ret = session_regenerate_id($destroy);
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
session_write_close();
$backup = $_SESSION;
session_start();
$_SESSION = $backup;
return $ret;
}
示例6: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (!$this->started) {
$this->start();
}
if ($lifetime !== null) {
$this->options['cookie_lifetime'] = $lifetime;
}
if ($destroy) {
$this->metadataBag->stampNew($lifetime);
$this->handler->destroy($this->id);
} else {
$this->write();
}
$this->handler->close();
$this->id = $this->generator->generateId();
$this->handler->open(null, $this->name);
// read is required to make new session data at this point
$this->handler->read($this->id);
return true;
}
示例7: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
// Cannot regenerate the session ID for non-active sessions.
if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) {
return false;
}
// Check if session ID exists in PHP 5.3
if (PHP_VERSION_ID < 50400 && '' === session_id()) {
return false;
}
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$isRegenerated = session_regenerate_id($destroy);
// The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
// @see https://bugs.php.net/bug.php?id=70013
$this->loadSession();
return $isRegenerated;
}
示例8: regenerate
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
{
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
if ($destroy) {
$this->metadataBag->stampNew();
}
$ret = session_regenerate_id($destroy);
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
if ('files' === $this->getSaveHandler()->getSaveHandlerName()) {
session_write_close();
if (isset($_SESSION)) {
$backup = $_SESSION;
session_start();
$_SESSION = $backup;
} else {
session_start();
}
$this->loadSession();
}
return $ret;
}