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


PHP Cookie::save方法代碼示例

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


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

示例1: 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

示例2: indexAction

 public function indexAction()
 {
     Cookie::save("hello", "world");
     //reids
     //SRedis::set("test",time());
     //SRedis::get("test");
     //Log
     //Log::useDailyFiles(BASE_PATH . "/app/logs/custom.log", 7);
     //Log::info("this is custom file");
     return View::make('index', ["cookie" => Cookie::get("hello")]);
 }
開發者ID:ohworkit,項目名稱:SiriusDemo,代碼行數:11,代碼來源:IndexController.php

示例3: Lang

 function Lang()
 {
     $c = new Cookie(COOKIE_NAME_VIEW);
     // look if reload lang file
     $this->fileAdress = INCLUDE_PATH . "/config/lang_available.php";
     if (!file_exists($this->fileAdress)) {
         $this->reloadLangFile();
     } else {
         require $this->fileAdress;
         if (!isset($langAvailable)) {
             print "There is a problem with the /config/lang_available.php file.";
             $langAvailableFile = INCLUDE_PATH . "/config/lang_available.php";
             if (!unlink($langAvailableFile)) {
                 print "Error when trying to delete {$langAvailableFile}. You have to delete the file {$langAvailableFile} manually.";
             }
             print "<br>Please refresh this page";
             exit;
         }
         $this->langAvailable = $langAvailable;
     }
     $langRequest = Request::getLang();
     if (!file_exists(LANGS_PATH . "/" . $langRequest)) {
         // cookie ?
         if (($langRequest = $c->getVar('lang')) && file_exists(LANGS_PATH . "/" . $langRequest)) {
             $this->file = $langRequest;
         } else {
             // default lang?
             if (defined('INTERFACE_DEFAULT_LANG') && file_exists(LANGS_PATH . "/" . INTERFACE_DEFAULT_LANG)) {
                 $this->file = INTERFACE_DEFAULT_LANG;
             }
         }
     } else {
         $this->file = $langRequest;
     }
     // if lang not found in REQUEST + COOKIE + not set with INTERFACE_DEFAULT_LANG
     // then we try to choose the better lang
     if (!isset($this->file) || !strpos($this->file, 'utf-8.php') || strpos($this->file, '..') !== FALSE) {
         $this->file = $this->getNearestLang();
     }
     $this->setLang();
     // cookie
     $c->setVar('lang', $this->file);
     $c->save();
     //print($c->toString());
     //print($this->file);
 }
開發者ID:ber5ien,項目名稱:www.jade-palace.co.uk,代碼行數:46,代碼來源:Lang.class.php

示例4: setCookie

 public static function setCookie($user, $name, $value, $expires)
 {
     //self::cleanCookies();
     $cookie = self::getCookieObject($user, $name);
     if ($cookie) {
         $cookie->setValue($value);
         $cookie->setExpires(date("Y-m-d H:i:s", $expires));
         $cookie->save();
     } else {
         $cookie = new Cookie();
         $cookie->setUserId($user->getId());
         $cookie->setName($name);
         $cookie->setValue($value);
         $cookie->setExpires(date("Y-m-d H:i:s", $expires));
         $cookie->save();
     }
 }
開發者ID:auphau,項目名稱:joyreactor,代碼行數:17,代碼來源:Cookie.class.php


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