本文整理汇总了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();
}
}
}
示例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');
}
}
示例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());
}
示例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;
}
示例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();
}
}
示例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;
}
示例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');
}
}
示例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();
}
示例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);
}
}
示例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);
}
}
}
}
示例11: check
/**
* 验证并删除验证码
* @param $input
* @return bool
*/
public function check($input)
{
$result = $this->test($input);
//从Session中删除code
$this->store->remove($this->getFullName());
return $result;
}
示例12: unsetVar
/**
* Removes a variable from the session.
*
* @param $name
*/
public function unsetVar($name)
{
if (null === $this->session) {
return;
}
$this->session->remove($name);
}
示例13: getUploadFileAction
/**
* @Route("/getuploadfile", name="_getuploadfile")
*/
public function getUploadFileAction()
{
$Session = new Session();
echo json_encode($Session->get('comment_id'));
$Session->remove('comment_id');
die;
}
示例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);
}
}
示例15: getMessage
public function getMessage(Session $session)
{
$message = null;
if ($session->has('message')) {
$message = $session->get('message');
$session->remove('message');
}
return $message;
}