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


PHP IRequest::getCookie方法代碼示例

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


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

示例1: __construct

 /**
  * @param Http\IRequest $httpRequest
  * @param Http\IResponse $httpResponse
  */
 public function __construct(Http\IRequest $httpRequest, Http\IResponse $httpResponse)
 {
     $this->httpRequest = $httpRequest;
     $this->httpResponse = $httpResponse;
     if ($this->httpRequest->getQuery(self::SWITCH_PARAM)) {
         $this->viewType = $this->httpRequest->getQuery(self::SWITCH_PARAM);
     } else {
         if ($this->httpRequest->getCookie(self::COOKIE_KEY)) {
             $this->viewType = $this->httpRequest->getCookie(self::COOKIE_KEY);
         }
     }
 }
開發者ID:jirinapravnik,項目名稱:mobile-detect,代碼行數:16,代碼來源:DeviceView.php

示例2: __construct

 /**
  * @param \DK\Translator\Loaders\Loader|string $pathOrLoader
  * @param \Nette\Http\IRequest $httpRequest
  */
 public function __construct($pathOrLoader, IRequest $httpRequest = null)
 {
     parent::__construct($pathOrLoader);
     if ($httpRequest !== null) {
         $this->debugMode = (bool) $httpRequest->getCookie(Panel::COOKIE_DEBUG_KEY);
     }
 }
開發者ID:carrooi,項目名稱:nette-translator,代碼行數:11,代碼來源:Translator.php

示例3: getMetadataCookie

 /**
  * Parses the metadata cookie that our Javascript API set
  *
  * @return array
  */
 protected function getMetadataCookie()
 {
     $cookieName = $this->config->getMetadataCookieName();
     // The cookie value can be wrapped in "-characters so remove them
     if (!($cookieValue = trim($this->httpRequest->getCookie($cookieName), '"'))) {
         return array();
     }
     parse_str($cookieValue, $metadata);
     array_walk($metadata, function (&$value, &$key) {
         $value = urldecode($value);
         $key = urldecode($key);
     });
     return $metadata;
 }
開發者ID:kdyby,項目名稱:facebook,代碼行數:19,代碼來源:Facebook.php

示例4: exists

 /**
  * Does session exists for the current request?
  * @return bool
  */
 public function exists()
 {
     return self::$started || $this->request->getCookie($this->getName()) !== NULL;
 }
開發者ID:genextwebs,項目名稱:dropbox-sample,代碼行數:8,代碼來源:Session.php

示例5: start

 /**
  * Starts and initializes session data.
  *
  * @throws Nette\InvalidStateException
  * @return void
  */
 public function start()
 {
     if (self::$started) {
         return;
     }
     $this->configure($this->options);
     Nette\Diagnostics\Debugger::tryError();
     session_start();
     if (Nette\Diagnostics\Debugger::catchError($e) && !session_id()) {
         @session_write_close();
         // this is needed
         throw new Nette\InvalidStateException('session_start(): ' . $e->getMessage(), 0, $e);
     }
     self::$started = true;
     /* structure:
            __NF: Counter, BrowserKey, Data, Meta, Time
                DATA: section->variable = data
                META: section->variable = Timestamp, Browser, Version
        */
     unset($_SESSION['__NT'], $_SESSION['__NS'], $_SESSION['__NM']);
     // old unused structures
     // initialize structures
     $nf =& $_SESSION['__NF'];
     if (empty($nf)) {
         // new session
         $nf = array('C' => 0);
     } else {
         $nf['C']++;
     }
     // session regenerate every 30 minutes
     $nfTime =& $nf['Time'];
     $time = time();
     if ($time - $nfTime > self::REGENERATE_INTERVAL) {
         $this->regenerated = $this->regenerated || isset($nfTime);
         $nfTime = $time;
     }
     // browser closing detection
     $browserKey = $this->request->getCookie('nette-browser');
     if (!$browserKey) {
         $browserKey = Nette\Utils\Strings::random();
     }
     $browserClosed = !isset($nf['B']) || $nf['B'] !== $browserKey;
     $nf['B'] = $browserKey;
     // resend cookie
     $this->sendCookie();
     // process meta metadata
     if (isset($nf['META'])) {
         $now = time();
         // expire section variables
         foreach ($nf['META'] as $section => $metadata) {
             if (is_array($metadata)) {
                 foreach ($metadata as $variable => $value) {
                     if (!empty($value['B']) && $browserClosed || !empty($value['T']) && $now > $value['T'] || isset($nf['DATA'][$section][$variable]) && is_object($nf['DATA'][$section][$variable]) && (isset($value['V']) ? $value['V'] : null) != Nette\Reflection\ClassType::from($nf['DATA'][$section][$variable])->getAnnotation('serializationVersion')) {
                         if ($variable === '') {
                             // expire whole section
                             unset($nf['META'][$section], $nf['DATA'][$section]);
                             continue 2;
                         }
                         unset($nf['META'][$section][$variable], $nf['DATA'][$section][$variable]);
                     }
                 }
             }
         }
     }
     if ($this->regenerated) {
         $this->regenerated = false;
         $this->regenerateId();
     }
     register_shutdown_function(array($this, 'clean'));
 }
開發者ID:TheTypoMaster,項目名稱:SPHERE-Framework,代碼行數:76,代碼來源:Session.php

示例6: getCookie

 /**
  * @inheritdoc
  */
 public function getCookie($key, $default = NULL)
 {
     return $this->current->getCookie($key, $default);
 }
開發者ID:Kdyby,項目名稱:RequestStack,代碼行數:7,代碼來源:RequestStack.php

示例7: beforeRender

 public function beforeRender()
 {
     $this->template->cssLoaderFile = $this->cssLoaderFile;
     $this->template->jsLoaderFile = $this->jsLoaderFile;
     $this->template->fullcss = $this->httpRequest->getCookie('fullcss');
 }
開發者ID:george-oakling,項目名稱:web-project-advanced,代碼行數:6,代碼來源:BasePresenter.php


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