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


PHP Session::remove方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\Session::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::remove方法的具体用法?PHP Session::remove怎么用?PHP Session::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\Session\Session的用法示例。


在下文中一共展示了Session::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onKernelRequest

 public function onKernelRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         // don't do anything if it's not the master request
         return;
     }
     $token = $this->context->getToken();
     if (is_null($token)) {
         return;
     }
     $_route = $event->getRequest()->attributes->get('_route');
     if ($this->context->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         if (!$token->getUser() instanceof PersonInterface) {
             // We don't have a PersonInterface... Nothing to do here.
             return;
         }
         if ($_route == 'lc_home' || $_route == 'fos_user_security_login') {
             $key = '_security.main.target_path';
             #where "main" is your firewall name
             //check if the referer session key has been set
             if ($this->session->has($key)) {
                 //set the url based on the link they were trying to access before being authenticated
                 $url = $this->session->get($key);
                 //remove the session key
                 $this->session->remove($key);
             } else {
                 $url = $this->router->generate('lc_dashboard');
             }
             $event->setResponse(new RedirectResponse($url));
         } else {
             $this->checkUnconfirmedEmail();
         }
     }
 }
开发者ID:hacklabr,项目名称:login-cidadao,代码行数:34,代码来源:LoggedInUserListener.php

示例2: setAuthenticated

 /**
  * Sets the authentication flag.
  *
  * @param bool $authenticated The authentication status
  */
 public function setAuthenticated($authenticated)
 {
     if (true === $authenticated) {
         $this->session->set('_auth_until', time() + $this->timeout);
     } else {
         $this->session->remove('_auth_until');
     }
 }
开发者ID:burguin,项目名称:test02,代码行数:13,代码来源:InstallToolUser.php

示例3: getSuccessRedirectUrl

 public function getSuccessRedirectUrl()
 {
     if ($this->session->get('redir')) {
         $redirectUrl = $this->session->get('redir');
         $this->session->remove('redir');
         return $redirectUrl;
     }
     return $this->router->generate($this->googleAuthConfiguration->getSuccessAuthorizationRedirectUrl());
 }
开发者ID:xsolve-pl,项目名称:xsolve-google-auth-bundle,代码行数:9,代码来源:RedirectManager.php

示例4: getMessageBag

 protected function getMessageBag() : MessageBag
 {
     $messageBag = $this->session->get(self::SESSION_ID);
     if ($messageBag === null) {
         return new MessageBag();
     }
     $this->session->remove(self::SESSION_ID);
     return $messageBag;
 }
开发者ID:sidroberts,项目名称:flash,代码行数:9,代码来源:Flash.php

示例5: clear

 /**
  * Clears the storage
  *
  * @return void
  */
 public function clear()
 {
     if ($this->session->isStarted()) {
         $this->session->remove(self::SESSION_STO_KEY . '-' . $this->namespace);
     }
     if ($this->isApplyStrategy()) {
         $this->applySessionStrategy();
     }
 }
开发者ID:fwk,项目名称:security,代码行数:14,代码来源:SessionStorage.php

示例6: pullMessages

 public function pullMessages($parentRoute = null)
 {
     if ($this->session->has(Messages::$_MESSAGES_POOL_NAME)) {
         $poolOfMessages = $this->session->get(Messages::$_MESSAGES_POOL_NAME);
         $this->session->remove(Messages::$_MESSAGES_POOL_NAME);
     } else {
         $poolOfMessages = null;
     }
     return $poolOfMessages;
 }
开发者ID:tellaw,项目名称:leadsfactory,代码行数:10,代码来源:Messages.php

示例7: oldInput

 /**
  * Loads input from the session, which has been persisted through the response class
  *
  * @return void
  * @author Dan Cox
  */
 public function oldInput()
 {
     if ($this->session->has('input\\old')) {
         $input = $this->session->get('input\\old');
         $type = $this->session->get('input\\old.type');
         $deobsfucated = unserialize(base64_decode($input));
         $this->putInput($deobsfucated, $type);
         $this->session->remove('input\\old');
         $this->session->remove('input\\old.type');
     }
 }
开发者ID:antoligy,项目名称:Framework,代码行数:17,代码来源:Request.php

示例8: logout

 /**
  * @param boolean $destroy
  *
  * @return boolean
  */
 public function logout($destroy = false)
 {
     if ($destroy === true) {
         $this->session->invalidate();
     } else {
         $this->session->remove(self::USER_ID);
         $this->session->remove(self::USER_NAME);
         $this->session->remove(self::USER_GROUPS);
         $this->session->migrate();
     }
     return !$this->isLogin();
 }
开发者ID:corpsee,项目名称:nameless-source,代码行数:17,代码来源:User.php

示例9: set

 public function set($name, $value = null)
 {
     if (is_null($value)) {
         $this->profiler->debug('session.remove.' . $name);
         $this->session->remove($value);
     } else {
         if ($value instanceof Entity) {
             $value = $value->export();
         }
         $this->profiler->debug('session.set.' . $name, $value);
         $this->session->set($name, $value);
     }
 }
开发者ID:leoza,项目名称:api-client-bundle,代码行数:13,代码来源:Session.php

示例10: unsetUpload

 /**
  * Methode permettant de suprimmer un élement dans les uploads dans la session
  *
  * @param int $id id de la pièce
  */
 public function unsetUpload($id)
 {
     if (array_key_exists('uploads', $this->session->all())) {
         $uploads = $this->session->get('uploads');
         $key = array_search(intval($id), $uploads);
         if (is_numeric($key)) {
             unset($uploads[$key]);
             if (empty($uploads)) {
                 $this->session->remove('uploads');
             } else {
                 $this->session->set('uploads', $uploads);
             }
         }
     }
 }
开发者ID:KristenGarnier,项目名称:temporary,代码行数:20,代码来源:SessionHandler.php

示例11: check

 /**
  * 验证并删除验证码
  * @param $input
  * @return bool
  */
 public function check($input)
 {
     $result = $this->test($input);
     //从Session中删除code
     $this->store->remove($this->getFullName());
     return $result;
 }
开发者ID:vicens,项目名称:captcha,代码行数:12,代码来源:Builder.php

示例12: unsetVar

 /**
  * Removes a variable from the session.
  *
  * @param $name
  */
 public function unsetVar($name)
 {
     if (null === $this->session) {
         return;
     }
     $this->session->remove($name);
 }
开发者ID:ekyna,项目名称:table,代码行数:12,代码来源:RequestHelper.php

示例13: getUploadFileAction

 /**
  * @Route("/getuploadfile", name="_getuploadfile")
  */
 public function getUploadFileAction()
 {
     $Session = new Session();
     echo json_encode($Session->get('comment_id'));
     $Session->remove('comment_id');
     die;
 }
开发者ID:niceit,项目名称:sf-tracker,代码行数:10,代码来源:IssuesCommentsController.php

示例14: remove

 /**
  * Removes the named value
  *
  * @param string $name
  * @return void
  */
 public function remove($name)
 {
     if ($this->container instanceof WP_Session) {
         $this->container->offsetUnset($name);
     } else {
         $this->container->remove($name);
     }
 }
开发者ID:bravadomizzou,项目名称:dewdrop,代码行数:14,代码来源:Session.php

示例15: getMessage

 public function getMessage(Session $session)
 {
     $message = null;
     if ($session->has('message')) {
         $message = $session->get('message');
         $session->remove('message');
     }
     return $message;
 }
开发者ID:swnsma,项目名称:coursework3.1,代码行数:9,代码来源:BaseController.php


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