本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::setId方法的具体用法?PHP SessionInterface::setId怎么用?PHP SessionInterface::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::setId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetId
public function testSetId()
{
$this->assertEquals('', $this->session->getId());
$this->session->setId('0123456789abcdef');
$this->session->start();
$this->assertEquals('0123456789abcdef', $this->session->getId());
}
示例2: onKernelRequest
public function onKernelRequest(GetResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
return;
}
$request = $event->getRequest();
if ($request->request->has('sessionId')) {
$request->cookies->set($this->session->getName(), 1);
$sessionId = $this->encryption->decrypt($request->request->get('sessionId'));
$this->session->setId($sessionId);
}
}
示例3: onSiteAccessMatch
public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
{
if (!$this->session || $event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
return;
}
$sessionName = $this->session->getName();
$request = $event->getRequest();
if (!$this->session->isStarted() && !$request->hasPreviousSession() && $request->request->has($sessionName)) {
$this->session->setId($request->request->get($sessionName));
$this->session->start();
}
}
示例4: onRequest
/**
* Set the session ID from request cookies
*
* @param GetResponseEvent $event
*/
public function onRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$request->setSession($this->session);
$this->appendRealmToName($request);
$name = $this->session->getName();
if ($request->cookies->has($name)) {
$this->session->setId($request->cookies->get($name));
$this->session->start();
}
}
示例5: onRequest
/**
* Set the session ID from request cookies
*
* @param GetResponseEvent $event
*/
public function onRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$request->setSession($this->session);
$name = $this->session->getName();
if ($this->options->getBoolean('restrict_realm')) {
$name .= md5($request->getHttpHost() . $request->getBaseUrl());
$this->session->setName($name);
}
if ($request->cookies->has($name)) {
$this->session->setId($request->cookies->get($name));
$this->session->start();
}
}
示例6: initSession
protected function initSession(Request $request)
{
// the name of the session cookie name.
$sessionName = $this->session->getName();
// if a session cookie exists, load the appropriate session ID.
if ($request->cookies->has($sessionName)) {
$this->session->setId($request->cookies->get($sessionName));
}
// in some rare cases you may want to force the session to start on
// every request.
if ($this->forceStart) {
$this->session->start();
}
}
示例7: startSession
/**
* Prepare and start the session instance with data from the given request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return void
*/
protected function startSession(Request $request)
{
$this->session->setId($request->cookies->get('fluxbb_session'));
$this->session->start();
}
示例8: setId
/**
* Set the session ID
*
* @param string $id Session ID
* @return void
* @since 1.9
*/
public function setId($id)
{
$this->storage->setId($id);
}