當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cookie::delete方法代碼示例

本文整理匯總了PHP中Cookie::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cookie::delete方法的具體用法?PHP Cookie::delete怎麽用?PHP Cookie::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cookie的用法示例。


在下文中一共展示了Cookie::delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: logout

 public function logout()
 {
     $this->user = null;
     $this->token = null;
     Cookie::delete(self::COOKIE_NAME);
     Session::delete(self::SESSION_NAME);
 }
開發者ID:salomalo,項目名稱:php-oxygen,代碼行數:7,代碼來源:driver.class.php

示例2: run

 public static function run()
 {
     header('Content-type: text/html; charset=utf-8');
     // debug
     Debug::p('PHP Begin');
     $htmlDebug = Request::getGET('htmldebug');
     $ajaxDebug = Request::getGET('ajaxdebug');
     if ($htmlDebug == 'on') {
         Cookie::set('htmldebug', 1);
     }
     if ($htmlDebug == 'off') {
         Cookie::delete('htmldebug');
     }
     if ($ajaxDebug == 'on') {
         Cookie::set('ajaxdebug', 1);
     }
     if ($ajaxDebug == 'off') {
         Cookie::delete('ajaxdebug');
     }
     self::parseUrl();
     $path = empty(self::$CLASS_DIR) ? PROJECT_PATH . '/controller/' . self::$CLASS_NAME . '.class.php' : PROJECT_PATH . '/controller/' . self::$CLASS_DIR . '/' . self::$CLASS_NAME . '.class.php';
     if (!is_file($path)) {
         $userAgent = Arr::get('HTTP_USER_AGENT', $_SERVER, '');
         throw new FrameworkException("控製器:{$path} 不存在!User Agent: {$userAgent}");
     }
     require_once $path;
     $obj = new self::$CLASS_NAME();
     $actionName = self::$ACTION . 'Action';
     $obj->{$actionName}();
     // debug
     Debug::p('PHP End');
     if (isset($_COOKIE['htmldebug']) && !self::$IS_AJAX || isset($_COOKIE['ajaxdebug']) && self::$IS_AJAX) {
         Debug::show();
     }
 }
開發者ID:aozhongxu,項目名稱:web_hqoj,代碼行數:35,代碼來源:Router.class.php

示例3: logout

 /**
  *	@fn logout
  *	@short Action method that logs out a user.
  */
 function logout()
 {
     Cookie::delete('_u');
     Cookie::delete('_uid');
     $this->flash(l('Logout was performed successfully'), 'message');
     $this->redirect_to(array('controller' => 'home'));
 }
開發者ID:emeraldion,項目名稱:zelda,代碼行數:11,代碼來源:login_controller.php

示例4: logout

 /**
  * Logout
  */
 public function logout($params)
 {
     Cookie::delete('login');
     Session::delete('username');
     header('Location: ' . $params['redirect']);
     exit;
 }
開發者ID:hugonicolas,項目名稱:Site,代碼行數:10,代碼來源:User.php

示例5: login_out

 function login_out()
 {
     Cookie::delete('feifa_admin');
     if (empty($_COOKIE['feifa_admin'])) {
         $this->redirect('Admin-Login/index');
     }
 }
開發者ID:xuping123,項目名稱:kshop,代碼行數:7,代碼來源:LoginAction.class.php

示例6: init

 function init($request)
 {
     parent::init($request);
     $ck = new Cookie(COOKIE_NAME_SESSION);
     $ck->delete();
     Request::redirectToModule('index');
 }
開發者ID:ber5ien,項目名稱:www.jade-palace.co.uk,代碼行數:7,代碼來源:Logout.class.php

示例7: logout

 public function logout()
 {
     import('ORG.Util.Cookie');
     //Cookie::set('authcookie', authcode("$user_name\t$user_id\t",'ENCODE'), 31536000);
     Cookie::delete('authcookie');
     return true;
 }
開發者ID:huping112004,項目名稱:taobaoke,代碼行數:7,代碼來源:MemberModel.class.php

示例8: action_logout

 /**
  * Wylogowywanie
  */
 public function action_logout()
 {
     Auth::instance()->logout();
     Session::instance()->destroy();
     Cookie::delete('authautologin');
     exit;
 }
開發者ID:korejwo,項目名稱:coc,代碼行數:10,代碼來源:User.php

示例9: get

	/**
	 * Gets the value of a signed cookie. Cookies without signatures will not
	 * be returned. If the cookie signature is present, but invalid, the cookie
	 * will be deleted.
	 *
	 *     // Get the "theme" cookie, or use "blue" if the cookie does not exist
	 *     $theme = Cookie::get('theme', 'blue');
	 *
	 * @param   string  cookie name
	 * @param   mixed   default value to return
	 * @return  string
	 */
	public static function get($key, $default = NULL)
	{
		if ( ! isset($_COOKIE[$key]))
		{
			// The cookie does not exist
			return $default;
		}

		// Get the cookie value
		$cookie = $_COOKIE[$key];

		// Find the position of the split between salt and contents
		$split = strlen(Cookie::salt($key, NULL));

		if (isset($cookie[$split]) AND $cookie[$split] === '~')
		{
			// Separate the salt and the value
			list ($hash, $value) = explode('~', $cookie, 2);

			if (Cookie::salt($key, $value) === $hash)
			{
				// Cookie signature is valid
				return $value;
			}

			// The cookie signature is invalid, delete it
			Cookie::delete($key);
		}

		return $default;
	}
開發者ID:nevermlnd,項目名稱:cv,代碼行數:43,代碼來源:cookie.php

示例10: setUser

 /**
  * Sets the currently logged in user.
  * @param User $user The user to set.
  * @param string $password The password of the user, just to be sure.
  */
 public static function setUser(User $user, $password)
 {
     // Let's first issue a new session token to null out any old forms
     Session::issueToken();
     // Make sure the user isn't a guest and the password works
     if ($user == null || $user->isGuest() || !$user->isPassword($password)) {
         // Delete the cookies
         Cookie::delete('userid');
         Cookie::delete('sid');
         // Set the user to a guest
         self::$user = User::guest();
         return;
     }
     // Make sure this isn't already the signed in user
     if (self::$user != null && self::$user->getUserId() == $user->getUserId()) {
         return;
     }
     // Set the cookies
     Cookie::set('userid', $user->getUserId());
     Cookie::set('sid', $user->getCookiePassword());
     // Update the user's visit times
     $user->updateVisitInfo();
     // Let's now set the local version
     self::$user = $user;
 }
開發者ID:brandonfrancis,項目名稱:scsapi,代碼行數:30,代碼來源:auth.php

示例11: action_delete

 public function action_delete()
 {
     $name = $this->request->query('name');
     if (Cookie::delete($name)) {
         echo json_decode(array($name => 1));
     }
 }
開發者ID:rhrn,項目名稱:apirn,代碼行數:7,代碼來源:cookie.php

示例12: process

 function process()
 {
     $siteAdmin = $this->needASiteAdminSelected();
     if ($siteAdmin) {
         $choice = $this->request->getConfirmedState();
         $cookieSet = false;
         // is the cookie already set or not?
         if (isset($_COOKIE[COOKIE_NAME_NO_STAT . $siteAdmin])) {
             $cookieSet = true;
         }
         if ($choice == 1) {
             $ck = new Cookie(COOKIE_NAME_NO_STAT . $siteAdmin);
             if ($cookieSet) {
                 $ck->delete();
             } else {
                 $ck->save();
             }
             $this->setMessage();
         } else {
             if ($cookieSet) {
                 $this->tpl->assign("cookie_no_stat", true);
             } else {
                 $this->tpl->assign("cookie_no_stat", false);
             }
         }
     }
 }
開發者ID:ber5ien,項目名稱:www.jade-palace.co.uk,代碼行數:27,代碼來源:AdminSiteCookieExclude.class.php

示例13: action_authorize

 public function action_authorize()
 {
     if ($this->token and $this->token->token !== Arr::get($_GET, 'oauth_token')) {
         // Delete the token, it is not valid
         Cookie::delete($this->cookie);
         // Send the user back to the beginning
         Request::instance()->redirect($this->request->uri(array('action' => 'index')));
     }
     // Get the verifier
     $verifier = Arr::get($_GET, 'oauth_verifier');
     // Store the verifier in the token
     $this->token->verifier($verifier);
     // Exchange the request token for an access token
     $this->token = $this->provider->access_token($this->consumer, $this->token);
     // Store the access token
     Cookie::set($this->cookie, serialize($this->token));
     // At this point, we need to retrieve a unique twitter id for the user.
     $response = OAuth_Request::factory('resource', 'GET', 'http://api.twitter.com/1/account/verify_credentials.json')->param('oauth_consumer_key', Kohana::config('oauth.twitter.key'))->param('oauth_token', $this->token)->sign(OAuth_Signature::factory('HMAC-SHA1'), $this->consumer, $this->token)->execute();
     $response = json_decode($response);
     $twitter_id = $response->screen_name;
     $user = ORM::factory('user')->where('username', '=', $twitter_id)->find();
     !$user->id and Request::instance()->redirect('/auth/confirm?id=' . $twitter_id);
     Auth::instance()->force_login($user);
     Session::instance()->set('notification', 'Succesfully logged in.');
     Request::instance()->redirect('/');
 }
開發者ID:badsyntax,項目名稱:2do,代碼行數:26,代碼來源:oauth.php

示例14: logout

 public function logout()
 {
     Cookie::delete('username');
     Cookie::delete('lastlogintime');
     $this->assign("jumpUrl", "__APP__/index/index");
     $this->success('您已經成功退出,歡迎您的下次登錄!');
 }
開發者ID:bigtrees,項目名稱:qianxuehui,代碼行數:7,代碼來源:UserController.class.php

示例15: get

 /**
  * Get cookie value(s)
  * 
  * @param string $name      Name of the cookie to get
  * @param mixed $default    [optional] Default value if cookie is not set. Default is false
  * @return mixed            Cookie stored datas
  */
 public static function get($name, $default = false)
 {
     // handling array notation
     if (preg_match('#^(.*?)\\[(.*?)\\]$#', $name, $m)) {
         if (!isset($_COOKIE[$m[1]][$m[2]])) {
             return $default;
         }
         $value = $_COOKIE[$m[1]][$m[2]];
     } else {
         if (!isset($_COOKIE[$name])) {
             return $default;
         }
         $value = $_COOKIE[$name];
     }
     // retrieve cookie content
     $cookieValue = explode('|', $value);
     // hash is not correct
     if (count($cookieValue) !== 3 || !Security::check($cookieValue[0] . $cookieValue[1], $cookieValue[2])) {
         Cookie::delete($name);
         return $default;
     }
     $value = $cookieValue[0];
     // if content is a serialized array
     if ($v = @unserialize($value)) {
         $value = $v;
     }
     return $value;
 }
開發者ID:salomalo,項目名稱:php-oxygen,代碼行數:35,代碼來源:cookie.class.php


注:本文中的Cookie::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。