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