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


PHP Session::delete方法代码示例

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


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

示例1: redirectUrl

 /**
  * {@inheritDoc}
  */
 public function redirectUrl($url = null)
 {
     if ($url === null) {
         return $this->_session->read($this->_config['redirect']);
     }
     if ($url === false) {
         $this->_session->delete($this->_config['redirect']);
         return null;
     }
     $this->_session->write($this->_config['redirect'], $url);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:14,代码来源:SessionStorage.php

示例2: redirectUrl

 /**
  * Get the URL a user should be redirected to upon login.
  *
  * Pass a URL in to set the destination a user should be redirected to upon
  * logging in.
  *
  * If no parameter is passed, gets the authentication redirect URL. The URL
  * returned is as per following rules:
  *
  *  - Returns the normalized URL from session Auth.redirect value if it is
  *    present and for the same domain the current app is running on.
  *  - If there is no session value and there is a config `loginRedirect`, the
  *    `loginRedirect` value is returned.
  *  - If there is no session and no `loginRedirect`, / is returned.
  *
  * @param string|array $url Optional URL to write as the login redirect URL.
  * @return string Redirect URL
  */
 public function redirectUrl($url = null)
 {
     if ($url !== null) {
         $redir = $url;
         $this->session->write('Auth.redirect', $redir);
     } elseif ($this->session->check('Auth.redirect')) {
         $redir = $this->session->read('Auth.redirect');
         $this->session->delete('Auth.redirect');
         if (Router::normalize($redir) === Router::normalize($this->_config['loginAction'])) {
             $redir = $this->_config['loginRedirect'];
         }
     } elseif ($this->_config['loginRedirect']) {
         $redir = $this->_config['loginRedirect'];
     } else {
         $redir = '/';
     }
     if (is_array($redir)) {
         return Router::url($redir + ['_base' => false]);
     }
     return $redir;
 }
开发者ID:aoliverio,项目名称:bookmarker-tutorial,代码行数:39,代码来源:AuthComponent.php

示例3: delete

 /**
  * Wrapper for SessionComponent::del();
  *
  * In your controller: $this->Session->delete('Controller.sessKey');
  *
  * @param string $name the name of the session key you want to delete
  * @return bool true is session variable is set and can be deleted, false is variable was not set.
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::delete
  */
 public function delete($name)
 {
     return Session::delete($name);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:13,代码来源:SessionComponent.php

示例4: delete

 /**
  * Wrapper for SessionComponent::del();
  *
  * In your controller: $this->Session->delete('Controller.sessKey');
  *
  * @param string $name the name of the session key you want to delete
  * @return void
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::delete
  */
 public function delete($name)
 {
     $this->_session->delete($name);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:13,代码来源:SessionComponent.php

示例5: testSetLanguageWithSession

 /**
  * testSetLanguageWithSession method
  *
  * @return void
  */
 public function testSetLanguageWithSession()
 {
     Session::start();
     Session::write('Config.language', 'po');
     $singular = $this->_singular();
     $this->assertEquals('Po (translated)', $singular);
     $plurals = $this->_plural();
     $this->assertTrue(in_array('0 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('1 is 1 (po translated)', $plurals));
     $this->assertTrue(in_array('2 is 2-4 (po translated)', $plurals));
     $this->assertTrue(in_array('3 is 2-4 (po translated)', $plurals));
     $this->assertTrue(in_array('4 is 2-4 (po translated)', $plurals));
     $this->assertTrue(in_array('5 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('6 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('7 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('8 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('9 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('10 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('11 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('12 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('13 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('14 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('15 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('16 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('17 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('18 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('19 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('20 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('21 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('22 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('23 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('24 everything else (po translated)', $plurals));
     $this->assertTrue(in_array('25 everything else (po translated)', $plurals));
     Session::delete('Config.language');
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:40,代码来源:I18nTest.php

示例6: testCheckKeyWithSpaces

 /**
  * testCheckKeyWithSpaces method
  *
  * @return void
  */
 public function testCheckKeyWithSpaces()
 {
     $session = new Session();
     $session->write('Session Test', "test");
     $this->assertTrue($session->check('Session Test'));
     $session->delete('Session Test');
     $session->write('Session Test.Test Case', "test");
     $this->assertTrue($session->check('Session Test.Test Case'));
 }
开发者ID:Slayug,项目名称:castor,代码行数:14,代码来源:SessionTest.php

示例7: flash

 /**
  * Used to render the message set in Controller::Session::setFlash()
  *
  * In your view: $this->Session->flash('somekey');
  * Will default to flash if no param is passed
  *
  * You can pass additional information into the flash message generation. This allows you
  * to consolidate all the parameters for a given type of flash message into the view.
  *
  * {{{
  * echo $this->Session->flash('flash', array('params' => array('class' => 'new-flash')));
  * }}}
  *
  * The above would generate a flash message with a custom class name. Using $attrs['params'] you
  * can pass additional data into the element rendering that will be made available as local variables
  * when the element is rendered:
  *
  * {{{
  * echo $this->Session->flash('flash', array('params' => array('name' => $user['User']['name'])));
  * }}}
  *
  * This would pass the current user's name into the flash message, so you could create personalized
  * messages without the controller needing access to that data.
  *
  * Lastly you can choose the element that is rendered when creating the flash message. Using
  * custom elements allows you to fully customize how flash messages are generated.
  *
  * {{{
  * echo $this->Session->flash('flash', array('element' => 'my_custom_element'));
  * }}}
  *
  * If you want to use an element from a plugin for rendering your flash message you can do that using the
  * plugin param:
  *
  * {{{
  * echo $this->Session->flash('flash', array(
  *   'element' => 'my_custom_element',
  *   'params' => array('plugin' => 'my_plugin')
  * ));
  * }}}
  *
  * @param string $key The [Message.]key you are rendering in the view.
  * @param array $attrs Additional attributes to use for the creation of this flash message.
  *    Supports the 'params', and 'element' keys that are used in the helper.
  * @return string
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::flash
  */
 public function flash($key = 'flash', $attrs = [])
 {
     if (!Session::check('Message.' . $key)) {
         return '';
     }
     $flash = Session::read('Message.' . $key);
     $message = $flash['message'];
     unset($flash['message']);
     if (!empty($attrs)) {
         $flash = array_merge($flash, $attrs);
     }
     if ($flash['element'] === 'default') {
         $class = 'message';
         if (!empty($flash['params']['class'])) {
             $class = $flash['params']['class'];
         }
         $out = $this->formatTemplate('flash', ['class' => $class, 'key' => $key, 'message' => $message]);
     } elseif (!$flash['element']) {
         $out = $message;
     } else {
         $options = array();
         if (isset($flash['params']['plugin'])) {
             $options['plugin'] = $flash['params']['plugin'];
         }
         $tmpVars = $flash['params'];
         $tmpVars['message'] = $message;
         $out = $this->_View->element($flash['element'], $tmpVars, $options);
     }
     Session::delete('Message.' . $key);
     return $out;
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:78,代码来源:SessionHelper.php


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