当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::isStarted方法代码示例

本文整理汇总了PHP中Nette\Http\Session::isStarted方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::isStarted方法的具体用法?PHP Session::isStarted怎么用?PHP Session::isStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Http\Session的用法示例。


在下文中一共展示了Session::isStarted方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPanel

 /**
  * Html code for DebugerBar Panel
  * @author Pavel Železný <info@pavelzelezny.cz>
  * @return string
  */
 public function getPanel()
 {
     $template = $this->getFileTemplate(__DIR__ . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'panel.latte');
     $template->session = $this->session->isStarted() ? $this->session : FALSE;
     $template->sessionMetaStore = isset($_SESSION['__NF']['META']) ? $_SESSION['__NF']['META'] : array();
     $template->sessionMaxTime = ini_get('session.gc_maxlifetime');
     $template->hiddenSections = $this->hiddenSections;
     return $template;
 }
开发者ID:richard-ejem,项目名称:nette-session-debug-bar,代码行数:14,代码来源:SessionPanel.php

示例2: checkCaptcha

 /**
  * Check if answer is corect
  * @param string $answer
  * @throws CookieException
  * @return bool
  */
 public function checkCaptcha($answer)
 {
     if (!$this->session->isStarted()) {
         throw new \Exception('Povolte cookies ve vašem prohlížeči');
     }
     if ($this->cutAnswer($answer) != $this->cutAnswer($this->sessSect->answer)) {
         $this->sessSect->status = 'answBad';
         throw new \Exception('Špatná odpověď na otázku, možná pouze špatně zapsaná');
     }
     $this->sessSect->status = 'answOk';
     return true;
 }
开发者ID:kivi8,项目名称:ars-poetica,代码行数:18,代码来源:CaptchaManager.php

示例3: resolve

 /**
  * @param Translator $translator
  * @return string|NULL
  */
 public function resolve(Translator $translator)
 {
     if (!$this->session->isStarted() && $this->httpResponse->isSent()) {
         trigger_error("The advice of session locale resolver is required but the session has not been started and headers had been already sent. " . "Either start your sessions earlier or disabled the SessionResolver.", E_USER_WARNING);
         return NULL;
     }
     if (empty($this->localeSession->locale)) {
         return NULL;
     }
     $short = array_map(function ($locale) {
         return substr($locale, 0, 2);
     }, $translator->getAvailableLocales());
     if (!in_array(substr($this->localeSession->locale, 0, 2), $short, TRUE)) {
         return NULL;
     }
     return $this->localeSession->locale;
 }
开发者ID:tomasstrejcek,项目名称:Translation,代码行数:21,代码来源:SessionResolver.php

示例4: requireSessions

 /**
  * @return void
  */
 private function requireSessions()
 {
     if (!$this->session->isStarted()) {
         throw new \RuntimeException('Session is not started, start session or use FileMailer instead.');
     }
     if (!isset($this->sessionSection->messages)) {
         $this->sessionSection->messages = array();
     }
 }
开发者ID:nextras,项目名称:mail-panel,代码行数:12,代码来源:SessionMailer.php

示例5: __construct

 public function __construct(Http\Session $session = NULL)
 {
     if ($session->isStarted()) {
         $session->destroy();
     }
     $session->setOptions(['cookie_disabled' => TRUE]);
 }
开发者ID:jirinapravnik,项目名称:twitter,代码行数:7,代码来源:TestCase.php

示例6: register

 /**
  * Registers CaptchaControl to the \Nette\Forms\Container, starts session and sets $defaultFontFile (if not set)
  *
  * @param \Nette\Http\Session $session session
  * @throws \Nette\InvalidStateException
  * @return void
  */
 public static function register(Session $session)
 {
     if (self::$registered === TRUE) {
         throw new InvalidStateException(__CLASS__ . ' is already registered.');
     }
     if ($session->isStarted() === FALSE) {
         $session->start();
     }
     self::$session = $session->getSection(__CLASS__);
     if (!self::$defaultFontFile) {
         self::$defaultFontFile = __DIR__ . '/fonts/Vera.ttf';
     }
     Container::extensionMethod('addCaptcha', function ($container, $name) {
         return $container[$name] = new static();
     });
     self::$registered = TRUE;
 }
开发者ID:radekdostal,项目名称:nette-captchacontrol,代码行数:24,代码来源:CaptchaControl.php

示例7: register

 /**
  * Register CaptchaControl to FormContainer, start session and set $defaultFontFile (if not set)
  * @return void
  * @throws \Nette\InvalidStateException
  */
 public static function register(Session $session)
 {
     if (self::$registered) {
         throw new \Nette\InvalidStateException(__CLASS__ . " is already registered");
     }
     if (!$session->isStarted()) {
         $session->start();
     }
     self::$session = $session->getSection(__CLASS__);
     if (!self::$defaultFontFile) {
         self::$defaultFontFile = __DIR__ . "/fonts/Vera.ttf";
     }
     FormContainer::extensionMethod('addCaptcha', callback(__CLASS__, 'addCaptcha'));
     self::$registered = TRUE;
 }
开发者ID:Kollarovic,项目名称:CaptchaControl,代码行数:20,代码来源:CaptchaControl.php


注:本文中的Nette\Http\Session::isStarted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。