當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。