当前位置: 首页>>代码示例>>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;未经允许,请勿转载。