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


PHP session_cache_limiter函数代码示例

本文整理汇总了PHP中session_cache_limiter函数的典型用法代码示例。如果您正苦于以下问题:PHP session_cache_limiter函数的具体用法?PHP session_cache_limiter怎么用?PHP session_cache_limiter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: startSession

 /**
  * Sets the time against which the session is measured. This function also
  * sets the cash_session_id internally as a mechanism for tracking analytics
  * against a consistent id, regardless of PHP session id.
  *
  * @return boolean
  */
 protected function startSession()
 {
     // begin PHP session
     if (!defined('STDIN')) {
         // no session for CLI, suckers
         @session_cache_limiter('nocache');
         $session_length = 3600;
         @ini_set("session.gc_maxlifetime", $session_length);
         @session_start();
     }
     $this->cash_session_timeout = ini_get("session.gc_maxlifetime");
     if (!isset($_SESSION['cash_session_id'])) {
         $modifier_array = array('deedee', 'johnny', 'joey', 'tommy', 'marky');
         $_SESSION['cash_session_id'] = $modifier_array[array_rand($modifier_array)] . '_' . rand(1000, 9999) . substr((string) time(), 4);
     }
     if (isset($_SESSION['cash_last_request_time'])) {
         if ($_SESSION['cash_last_request_time'] + $this->cash_session_timeout < time()) {
             $this->resetSession();
         }
     }
     $_SESSION['cash_last_request_time'] = time();
     if (!isset($GLOBALS['cash_script_store'])) {
         $GLOBALS['cash_script_store'] = array();
     }
     return true;
 }
开发者ID:nodots,项目名称:DIY,代码行数:33,代码来源:CASHData.php

示例2: __construct

 public function __construct($handler = null)
 {
     session_cache_limiter('');
     ini_set('session.use_cookies', 1);
     $this->setMetadataBag(null);
     $this->setSaveHandler($handler);
 }
开发者ID:professor93,项目名称:mobicms,代码行数:7,代码来源:NativeSessionStorage.php

示例3: init

 /**
  * Set up application environment
  *
  * This sets up the PHP environment, loads the provided module and returns
  * the MVC application.
  *
  * @param string $module Module to load
  * @param bool $addTestConfig Add config for test environment (enable all debug options, no config file)
  * @param array $applicationConfig Extends default application config
  * @return \Zend\Mvc\Application
  * @codeCoverageIgnore
  */
 public static function init($module, $addTestConfig = false, $applicationConfig = array())
 {
     // Set up PHP environment.
     session_cache_limiter('nocache');
     // Default headers to prevent caching
     return \Zend\Mvc\Application::init(array_replace_recursive(static::getApplicationConfig($module, $addTestConfig), $applicationConfig));
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:19,代码来源:Application.php

示例4: clean_ob

 /**
  * starts new clean output buffer
  *
  * @access  public
  *
  * @author  patrick.kracht
  */
 public function clean_ob()
 {
     if (!ob_get_length() || !ob_get_level()) {
         ob_start();
     }
     session_cache_limiter('must-revalidate');
 }
开发者ID:Zurzeithier,项目名称:zeiterfassung-hs-ulm,代码行数:14,代码来源:template.php

示例5: startSession

 public function startSession()
 {
     if (session_status() !== PHP_SESSION_ACTIVE) {
         session_cache_limiter(false);
         session_start();
     }
 }
开发者ID:alsvader,项目名称:percasBlog,代码行数:7,代码来源:Session.class.php

示例6: initialize

 public static function initialize()
 {
     // Set Redis as session handler
     ini_set('session.save_handler', 'redis');
     ini_set('session.save_path', 'unix:///var/run/redis/redis.sock?persistent=1');
     // Specify hash function used for session ids. Usually does not
     // work on FreeBSD unless hash functions are compiled into the binary
     // ini_set('session.hash_function', 'sha256');
     ini_set('session.hash_bits_per_character', 5);
     ini_set('session.entropy_length', 512);
     // Set session lifetime in redis (8h)
     ini_set('session.gc_maxlifetime', 28800);
     // Set cookie lifetime on client
     ini_set('session.cookie_lifetime', 0);
     // do not expose Cookie value to JavaScript (enforced by browser)
     ini_set('session.cookie_httponly', 1);
     if (Config::get('https_only') === true) {
         // only send cookie over https
         ini_set('session.cookie_secure', 1);
     }
     // prevent caching by sending no-cache header
     session_cache_limiter('nocache');
     // rename session
     session_name('SESSIONID');
 }
开发者ID:linearregression,项目名称:redports,代码行数:25,代码来源:Session.php

示例7: PbSessions

 function PbSessions($save_path = '')
 {
     global $_PB_CACHE;
     $iniSet = function_exists('ini_set');
     $this->save_path = $save_path;
     if (empty($_SESSION)) {
         if ($iniSet && !empty($_PB_CACHE['setting']['session_savepath'])) {
             if (isset($_SERVER['HTTPS'])) {
                 ini_set('session.cookie_secure', 1);
             }
             //Todo:
             //ini_set('session.use_cookies', 1);
             //ini_set('session.cookie_lifetime', $this->lifetime);
             if (!empty($this->save_path)) {
                 ini_set('session.save_path', $this->save_path);
             } elseif (defined("DATA_PATH")) {
                 session_save_path(DATA_PATH . "tmp" . DS);
             }
         }
     }
     if (headers_sent()) {
         if (empty($_SESSION)) {
             $_SESSION = array();
         }
         return false;
     } elseif (!isset($_SESSION)) {
         session_cache_limiter("must-revalidate");
         session_start();
         header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
         return true;
     } else {
         session_start();
         return true;
     }
 }
开发者ID:vuong93st,项目名称:w-game,代码行数:35,代码来源:session_php.class.php

示例8: init

 public function init($options = null)
 {
     $cookie_defaults = session_get_cookie_params();
     if (!isset($options['session_cookie_path']) && class_exists("waSystem")) {
         $options['session_cookie_path'] = waSystem::getInstance()->getRootUrl();
     }
     $options = array_merge(array('session_id' => null, 'auto_start' => true, 'session_cookie_lifetime' => $cookie_defaults['lifetime'], 'session_cookie_path' => $cookie_defaults['path'], 'session_cookie_domain' => $cookie_defaults['domain'], 'session_cookie_secure' => $cookie_defaults['secure'], 'session_cookie_httponly' => true, 'session_cache_limiter' => 'none'), $options);
     // initialize parent
     parent::init($options);
     if (isset($this->options['session_name'])) {
         session_name($this->options['session_name']);
     }
     if (!(bool) ini_get('session.use_cookies') && ($session_id = $this->options['session_id'])) {
         session_id($session_id);
     }
     $lifetime = $this->options['session_cookie_lifetime'];
     $path = $this->options['session_cookie_path'];
     $domain = $this->options['session_cookie_domain'];
     $secure = $this->options['session_cookie_secure'];
     $http_only = $this->options['session_cookie_httponly'];
     session_set_cookie_params($lifetime, $path, $domain, $secure, $http_only);
     if (null !== $this->options['session_cache_limiter']) {
         session_cache_limiter($this->options['session_cache_limiter']);
     }
     if ($this->options['auto_start']) {
         if (isset($_COOKIE[session_name()])) {
             $this->open();
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:30,代码来源:waSessionStorage.class.php

示例9: start

    /**
     * Starts the session.
     *
     * @api
     */
    public function start()
    {
        if (self::$sessionStarted) {
            return;
        }

        session_set_cookie_params(
            $this->options['lifetime'],
            $this->options['path'],
            $this->options['domain'],
            $this->options['secure'],
            $this->options['httponly']
        );

        // disable native cache limiter as this is managed by HeaderBag directly
        session_cache_limiter(false);

        if (!ini_get('session.use_cookies') && isset($this->options['id']) && $this->options['id'] && $this->options['id'] != session_id()) {
            session_id($this->options['id']);
        }

        session_start();

        self::$sessionStarted = true;
    }
开发者ID:pmjones,项目名称:php-framework-benchmarks,代码行数:30,代码来源:NativeSessionStorage.php

示例10: __construct

 function __construct($config)
 {
     if (!$config || !is_array($config)) {
         $config["id"] = "PHPSESSID";
         $config["path"] = "./data/session/";
         $config["timeout"] = 3600;
     }
     $this->config($config);
     $sid = $config["id"] ? $config["id"] : "PHPSESSION";
     session_name($sid);
     $this->sid = $sid;
     $session_id = isset($_POST[$sid]) ? $_POST[$sid] : (isset($_GET[$sid]) ? $_GET[$sid] : "");
     if ($session_id && preg_match("/^[a-z0-9A-Z\\_\\-]+\$/u", $session_id)) {
         session_id($session_id);
         $this->sessid = $session_id;
     } else {
         $this->sessid = session_id();
     }
     session_save_path($config["path"]);
     $this->config = $config;
     $this->timeout = $config["timeout"] ? $config["timeout"] : 600;
     session_cache_expire(intval($this->timeout) / 60);
     session_cache_limiter('public');
     session_start();
 }
开发者ID:joyerma,项目名称:yongzhuo,代码行数:25,代码来源:file.php

示例11: __construct

 /**
  * コンストラクタ
  *
  * ここでPHPの標準セッションがスタートする
  */
 public function __construct($session_name = null, $session_id = null, $use_cookies = true)
 {
     $this->setCookieHttpOnly();
     // キャッシュ制御なし
     session_cache_limiter('none');
     // セッション名およびセッションIDを設定
     if ($session_name) {
         session_name($session_name);
     }
     if ($session_id) {
         session_id($session_id);
     }
     // Cookie使用の可否に応じてiniディレクティブを変更
     if ($use_cookies) {
         ini_set('session.use_cookies', 1);
         ini_set('session.use_only_cookies', 1);
     } else {
         ini_set('session.use_cookies', 0);
         ini_set('session.use_only_cookies', 0);
     }
     // セッションデータを初期化する
     session_start();
     self::$_session_started = true;
     // Cookieが使用できず、session.use_trans_sidがOffの場合
     if (!$use_cookies && !ini_get('session.use_trans_sid')) {
         $snm = session_name();
         $sid = session_id();
         output_add_rewrite_var($snm, $sid);
     }
     /*
     Expires: Thu, 19 Nov 1981 08:52:00 GMT
     Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
     Pragma: no-cache
     */
 }
开发者ID:unpush,项目名称:p2-php,代码行数:40,代码来源:Session.php

示例12: init

 function init()
 {
     ini_set('session.cookie_lifetime', 60 * 60 * 24 * 30);
     // Persistent cookies
     ini_set('session.gc_maxlifetime', 60 * 60 * 24 * 30);
     // Garbage collection to match
     ini_set('session.cookie_httponly', true);
     // Restrict cookies to HTTP only (help reduce XSS attack profile)
     site()->db()->handleSession();
     session_name(site()->config->sessionname);
     session_start();
     session_cache_limiter('public');
     session_regenerate_id();
     // Session login / logout
     site()->addPageHandler('/session/login', '\\Idno\\Pages\\Session\\Login', true);
     site()->addPageHandler('/session/logout', '\\Idno\\Pages\\Session\\Logout');
     site()->addPageHandler('/currentUser/?', '\\Idno\\Pages\\Session\\CurrentUser');
     // Update the session on save, this is a shim until #46 is fixed properly with #49
     \Idno\Core\site()->addEventHook('save', function (\Idno\Core\Event $event) {
         $object = $event->data()['object'];
         if (!empty($object) && $object instanceof \Idno\Entities\User && (!empty($_SESSION['user']) && $object->getUUID() == $_SESSION['user']->getUUID())) {
             $_SESSION['user'] = $object;
         }
     });
 }
开发者ID:avewrigley,项目名称:idno,代码行数:25,代码来源:Session.php

示例13: __construct

 /**
  *  Ethna_Sessionクラスのコンストラクタ
  *
  *  @access public
  *  @param  string  $appid      アプリケーションID(セッション名として使用)
  *  @param  string  $save_dir   セッションデータを保存するディレクトリ
  */
 public function __construct($ctl, $appid)
 {
     $this->ctl = $ctl;
     $this->logger = $this->ctl->getLogger();
     $config = $this->ctl->getConfig()->get('session');
     if ($config) {
         $this->config = array_merge($this->config, $config);
     }
     $this->session_save_dir = $this->config['path'];
     if (($dir = $this->ctl->getDirectory($this->config['path'])) !== null) {
         $this->session_save_dir = $dir;
     }
     $this->session_name = $appid . $this->config['suffix'];
     // set session handler
     ini_set('session.save_handler', $this->config['handler']);
     session_save_path($this->session_save_dir);
     session_name($this->session_name);
     session_cache_limiter($this->config['cache_limiter']);
     session_cache_expire($this->config['cache_expire']);
     $this->session_start = false;
     if (isset($_SERVER['REQUEST_METHOD']) == false) {
         return;
     }
     if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0) {
         $http_vars = $_POST;
     } else {
         $http_vars = $_GET;
     }
     if (array_key_exists($this->session_name, $http_vars) && $http_vars[$this->session_name] != null) {
         $_COOKIE[$this->session_name] = $http_vars[$this->session_name];
     }
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:39,代码来源:Session.php

示例14: __construct

 /**
  * セッションを開始する
  * @param string $name
  * @return $this
  * 
  */
 public function __construct($name = 'sess')
 {
     $this->ses_n = $name;
     if ('' === session_id()) {
         $cookie_params = \ebi\Conf::cookie_params();
         session_name($cookie_params['session_name']);
         session_cache_expire($cookie_params['session_expire']);
         session_cache_limiter($cookie_params['session_limiter']);
         if ($cookie_params['cookie_lifetime'] > 0 || $cookie_params['cookie_path'] != '/' || !empty($cookie_params['cookie_domain']) || $cookie_params['cookie_secure'] !== false) {
             session_set_cookie_params($cookie_params['cookie_lifetime'], $cookie_params['cookie_path'], $cookie_params['cookie_domain'], $cookie_params['cookie_secure']);
         }
         if (static::has_class_plugin('session_read')) {
             ini_set('session.save_handler', 'user');
             session_set_save_handler([$this, 'open'], [$this, 'close'], [$this, 'read'], [$this, 'write'], [$this, 'destroy'], [$this, 'gc']);
             if (isset($this->vars[session_name()])) {
                 session_regenerate_id(true);
             }
         }
         session_start();
         register_shutdown_function(function () {
             if ('' != session_id()) {
                 session_write_close();
             }
         });
     }
 }
开发者ID:tokushima,项目名称:ebi,代码行数:32,代码来源:Session.php

示例15: __construct

 public function __construct($config)
 {
     if (!is_object($config)) {
         require_once 'Oops/Config.php';
         $config = new Oops_Config();
     }
     if (strlen($config->domain) && strpos($_SERVER['HTTP_HOST'], (string) $config->domain) !== false) {
         $this->_cookieDomain = $config->domain;
     }
     if (strlen($config->path)) {
         $this->_cookiePath = $config->path;
     }
     if (strlen($config->lifetime)) {
         $this->_cookieLifetime = $config->lifetime;
     }
     session_set_cookie_params($this->_cookieLifetime, $this->_cookiePath, $this->_cookieDomain);
     if (strlen($config->name)) {
         session_name($config->name);
     }
     if (strlen($config->cache_limiter)) {
         session_cache_limiter($config->cache_limiter);
     } else {
         session_cache_limiter('nocache');
     }
 }
开发者ID:laiello,项目名称:oops-project,代码行数:25,代码来源:Abstract.php


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