当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionInterface::setId方法代码示例

本文整理汇总了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());
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:7,代码来源:SessionTest.php

示例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);
     }
 }
开发者ID:csbill,项目名称:csbill,代码行数:12,代码来源:SessionRequestListener.php

示例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();
     }
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:12,代码来源:SessionInitByPostListener.php

示例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();
     }
 }
开发者ID:nbehier,项目名称:bolt,代码行数:19,代码来源:SessionListener.php

示例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();
     }
 }
开发者ID:robbert-vdh,项目名称:bolt,代码行数:22,代码来源:SessionListener.php

示例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();
     }
 }
开发者ID:autarky,项目名称:framework,代码行数:14,代码来源:SessionMiddleware.php

示例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();
 }
开发者ID:fluxbb,项目名称:core,代码行数:11,代码来源:SessionKernel.php

示例8: setId

 /**
  * Set the session ID
  *
  * @param string $id Session ID
  * @return void
  * @since 1.9
  */
 public function setId($id)
 {
     $this->storage->setId($id);
 }
开发者ID:elgg,项目名称:elgg,代码行数:11,代码来源:ElggSession.php


注:本文中的Symfony\Component\HttpFoundation\Session\SessionInterface::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。