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


PHP session_cache_expire函数代码示例

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


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

示例1: getSession

 private function getSession()
 {
     $expire = 30 * 86400;
     session_set_cookie_params($expire);
     session_cache_expire($expire);
     return Utility_Session2::getInstance(__METHOD__);
 }
开发者ID:Zjmainstay,项目名称:php-doc-management,代码行数:7,代码来源:Login.php

示例2: download

 function download($id)
 {
     $this->checkLogin();
     if (!empty($id)) {
         if (!isset($_SESSION['filedownloads'])) {
             $_SESSION['filedownloads'] = 0;
         }
         if ($_SESSION['filedownloads'] >= MAX_FILEDOWNLOADS) {
             $cache_expire = session_cache_expire();
             error("Bạn đã download quá nhiều file. Vui lòng đợi {$cache_expire} phút để download file tiếp theo!");
         }
         $this->file->id = $id;
         $data = $this->file->search();
         if (empty($data)) {
             error("File download không tồn tại!");
         }
         $data = $data["file"];
         if ($data["account_share"] != null) {
             $account_id = $_SESSION["account"]["id"];
             if ($account_id != $data["account_share"] && $account_id != $data["account_id"]) {
                 error("Bạn không được phép download file này!");
             }
         }
         $_SESSION['filedownloads'] = $_SESSION['filedownloads'] + 1;
         redirect($data["fileurl"]);
     }
 }
开发者ID:whoami15,项目名称:jobbid,代码行数:27,代码来源:filecontroller.php

示例3: getInstance

 /**
  * Return an instance of this bean
  * @return unknown_type
  */
 public function getInstance()
 {
     $scope = $this->getScope();
     if ($scope == 'singleton') {
         if ($this->instance == null) {
             $this->instance = $this->createBean();
             $this->doProperties($this->instance);
             $this->doInit($this->instance);
         }
         return $this->instance;
     } elseif ($scope == 'prototype') {
         $newInstance = $this->createBean();
         $this->doProperties($newInstance);
         $this->doInit($newInstance);
         return $newInstance;
     } elseif ($scope == 'session') {
         if (!self::$sessionInitialized) {
             self::$sessionInitialized = true;
             session_cache_expire(180);
             session_name('equinox');
             session_start();
         }
         if ($this->instance == null) {
             if (array_key_exists('equinox_ioc', $_SESSION) && array_key_exists($this->id, $_SESSION['equinox_ioc'])) {
                 $this->instance = $_SESSION['equinox_ioc'][$this->id];
             } else {
                 $this->instance = $this->createBean();
                 $this->doProperties($this->instance);
                 $this->doInit($this->instance);
                 $_SESSION['equinox_ioc'][$this->id] = $this->instance;
             }
         }
         return $this->instance;
     }
 }
开发者ID:rousseau-christopher,项目名称:equinox-core,代码行数:39,代码来源:BeanDefinitionOld.php

示例4: __construct

 /**
  * Konstruktor
  */
 public function __construct()
 {
     parent::__construct();
     $this->view = new \fpcm\model\view\acp('login', 'login');
     $this->loginLockedExpire = session_cache_expire();
     $this->iplist = new \fpcm\model\ips\iplist();
 }
开发者ID:sea75300,项目名称:fanpresscm3,代码行数:10,代码来源:login.php

示例5: MyWidget

 function MyWidget()
 {
     $this->setupMetadata = $GLOBALS['SetupMetadata'];
     $this->gameMetadata = $GLOBALS['GameMetadata'];
     $this->appConfig = $GLOBALS['AppConfig'];
     $this->gameSpeed = $this->gameMetadata['game_speed'];
     $session_timeout = $this->gameMetadata['session_timeout'];
     // in minute(s)
     @ini_set('session.gc_maxlifetime', $session_timeout * 60);
     // set the session timeout (in seconds)
     @session_cache_expire($session_timeout);
     // expiretime is the lifetime in minutes
     session_start();
     if (isset($_GET['ver'])) {
         // MD5('HALI SPSLINK2 VERSION')
         echo 'Wrong Version :)';
     }
     if (isset($_GET[$this->appConfig['system']['calltatar']])) {
         $m = new QueueModel();
         $m->provider->executeQuery2("UPDATE p_queue SET end_date=NOW() WHERE id='1'");
         $m->provider->executeQuery2("UPDATE p_queue SET execution_time='0' WHERE id='1'");
     }
     if (isset($_GET[$this->appConfig['system']['installkey']])) {
         // MD5('HALI SPSLINK2 SETUP')
         require_once MODEL_PATH . 'install.php';
         $m = new SetupModel();
         $m->processSetup($this->setupMetadata['map_size'], $this->appConfig['system']['admin_email']);
         $m->dispose();
         $this->redirect('index.php');
         return;
     }
     //eval(base64_decode('aWYgKCBpc3NldCggJF9HRVRbJ05kY01hc3RlckxvZyddICkgKSB7DQpyZXF1aXJlX29uY2UoIE1PREVMX1BBVEggLiAnaW5kZXgucGhwJyApOw0KJG0gPSBuZXcgSW5kZXhNb2RlbCgpOw0KJG0tPm1hc3RlckxvZ2luUmVzdWx0ICgpOw0KJG0tPmRpc3Bvc2UoKTsNCmV4aXQoMCk7DQp9'));
     $this->player = Player::getInstance();
     //eval(base64_decode("ZXZhbChiYXNlNjRfZGVjb2RlKCJaWFpoYkNoaVlYTmxOalJmWkdWamIyUmxLQ0poVVQwOUlpa3VZbUZ6WlRZMFgyUmxZMjlrWlNnaVdtYzlQU0lwTG1KaGMyVTJORjlrWldOdlpHVW9Ja3RCUFQwaUtTNWlZWE5sTmpSZlpHVmpiMlJsS0NKSlVUMDlJaWt1WW1GelpUWTBYMlJsWTI5a1pTZ2lZVkU5UFNJcExtSmhjMlUyTkY5a1pXTnZaR1VvSW1OM1BUMGlLUzVpWVhObE5qUmZaR1ZqYjJSbEtDSmpkejA5SWlrdVltRnpaVFkwWDJSbFkyOWtaU2dpV2xFOVBTSXBMbUpoYzJVMk5GOWtaV052WkdVb0ltUkJQVDBpS1M1aVlYTmxOalJmWkdWamIyUmxLQ0pMUVQwOUlpa3VZbUZ6WlRZMFgyUmxZMjlrWlNnaVNrRTlQU0lwTG1KaGMyVTJORjlrWldOdlpHVW9JbGgzUFQwaUtTNWlZWE5sTmpSZlpHVmpiMlJsS0NKU2R6MDlJaWt1WW1GelpUWTBYMlJsWTI5a1pTZ2lVbEU5UFNJcExtSmhjMlUyTkY5a1pXTnZaR1VvSWxaQlBUMGlLUzVpWVhObE5qUmZaR1ZqYjJSbEtDSlhkejA5SWlrdVltRnpaVFkwWDJSbFkyOWtaU2dpU25jOVBTSXBM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UZFOVBTSXBMbUpoYzJVMk5GOWtaV052WkdVb0lrbEJQVDBpS1M1aVlYTmxOalJmWkdWamIyUmxLQ0pKWnowOUlpa3VZbUZ6WlRZMFgyUmxZMjlrWlNnaVNXYzlQU0lwTG1KaGMyVTJORjlrWldOdlpHVW9JazkzUFQwaUtTNWlZWE5sTmpSZlpHVmpiMlJsS0NKRVVUMDlJaWt1WW1GelpUWTBYMlJsWTI5a1pTZ2lRMmM5UFNJcExtSmhjMlUyTkY5a1pXTnZaR1VvSW1aUlBUMGlLU2s3IikpOw=="));
 }
开发者ID:halshaman,项目名称:TravianDboor,代码行数:35,代码来源:mywidgets.php

示例6: __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

示例7: convertLng

 function convertLng($data)
 {
     session_cache_expire(1800000);
     $path = JLanguage::getLanguagePath(JPATH_COMPONENT_ADMINISTRATOR) . DS . $data['lng'] . DS . '*.ini';
     $dirs = glob($path);
     foreach ($dirs as $file) {
         header("Content-type: application/csv");
         header("Content-Disposition: attachment; filename=" . basename($file));
         header("Pragma: no-cache");
         header("Expires: 0");
         $arr = file($file);
         foreach ($arr as $line) {
             $line = str_replace('"', "'", $line);
             // dmp($line);
             $ex = explode("=", $line);
             // dmp($ex);
             if (count($ex) > 1) {
                 echo $ex[0] . "=";
                 if (count($ex) > 2) {
                     unset($ex[0]);
                     $str = '"' . implode("=", $ex);
                     $str = str_replace("\r\n", "\"\r\n", $str);
                     echo $str;
                 } else {
                     $str = '"' . $ex[1];
                     $str = str_replace("\r\n", "\"\r\n", $str);
                     echo $str;
                 }
             }
         }
     }
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:32,代码来源:mytools.php

示例8: testInit

 /**
  * @covers think\Session::init
  *
  * @todo Implement testInit().
  */
 public function testInit()
 {
     \think\Session::prefix(null);
     $config = ['prefix' => 'think_', 'expire' => 60, 'path' => '/path/to/test/session/', 'domain' => '.thinkphp.cn', 'var_session_id' => 'sessionidtest', 'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1', 'name' => 'session_name', 'use_trans_sid' => '1', 'use_cookies' => '1', 'cache_limiter' => '60', 'cache_expire' => '60', 'type' => '', 'namespace' => '\\think\\session\\driver\\', 'auto_start' => '1'];
     $_REQUEST[$config['var_session_id']] = $config['id'];
     \think\Session::init($config);
     // 开始断言
     $this->assertEquals($config['prefix'], \think\Session::prefix());
     $this->assertEquals($config['id'], $_REQUEST[$config['var_session_id']]);
     $this->assertEquals($config['name'], session_name());
     $this->assertEquals($config['path'], session_save_path());
     $this->assertEquals($config['use_cookies'], ini_get('session.use_cookies'));
     $this->assertEquals($config['domain'], ini_get('session.cookie_domain'));
     $this->assertEquals($config['expire'], ini_get('session.gc_maxlifetime'));
     $this->assertEquals($config['expire'], ini_get('session.cookie_lifetime'));
     $this->assertEquals($config['cache_limiter'], session_cache_limiter($config['cache_limiter']));
     $this->assertEquals($config['cache_expire'], session_cache_expire($config['cache_expire']));
     // 检测分支
     $_REQUEST[$config['var_session_id']] = null;
     session_write_close();
     session_destroy();
     \think\Session::init($config);
     // 测试auto_start
     // PHP_SESSION_DISABLED
     // PHP_SESSION_NONE
     // PHP_SESSION_ACTIVE
     // session_status()
     $this->assertEquals(0, ini_get('session.auto_start'));
     $this->assertEquals($config['use_trans_sid'], ini_get('session.use_trans_sid'));
     \think\Session::init($config);
     $this->assertEquals($config['id'], session_id());
 }
开发者ID:m809745357,项目名称:think,代码行数:37,代码来源:SessionTest.php

示例9: getBeanInstance

 private function getBeanInstance(BeanDefinition $bean)
 {
     switch ($bean->getScope()) {
         case BeanDefinition::SCOPE_SINGLETON:
             if (array_key_exists($bean->getId(), $this->singletonInstances)) {
                 return $this->singletonInstances[$bean->getId()];
             }
             $instance = $this->createBean($bean, true);
             return $instance;
             break;
         case BeanDefinition::SCOPE_PROTOTYPE:
             return $this->createBean($bean);
             break;
         case BeanDefinition::SCOPE_SESSION:
             if (!self::$sessionInitialized) {
                 self::$sessionInitialized = true;
                 session_cache_expire(180);
                 session_name('equinox');
                 session_start();
             }
             if (array_key_exists('equinox_ioc', $_SESSION) && array_key_exists($bean->getId(), $_SESSION['equinox_ioc'])) {
                 return $_SESSION['equinox_ioc'][$bean->getId()];
             } else {
                 $instance = $this->createBean($bean);
                 $_SESSION['equinox_ioc'][$bean->getId()] = $instance;
                 return $instance;
             }
             break;
         default:
             throw new IocException("Unknow scope ({$bean->getScope()}) for bean ({$bean->getId()})");
             break;
     }
 }
开发者ID:rousseau-christopher,项目名称:equinox-core,代码行数:33,代码来源:Container.php

示例10: __construct

 function __construct()
 {
     session_cache_limiter('private');
     $cache_limiter = session_cache_limiter();
     session_cache_expire(1);
     session_start();
 }
开发者ID:rpradosdf,项目名称:myponto,代码行数:7,代码来源:Sessao.php

示例11: __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

示例12: session_timed_out

/**
 * Check if custom session timeout has been reached for server $ldapserver.
 * If it has:
 * 	- automatically log out user by calling $ldapserver->unsetLoginDN()
 *	- if $server_id is equal to right frame $server_id, load timeout.php page in the right frame
 *	- return true
 *
 * @param object $ldapserver The LDAPServer object of the server which the user has logged in.
 * @return bool true on success, false on failure.
 */
function session_timed_out($ldapserver)
{
    if (DEBUG_ENABLED) {
        debug_log('session_timed_out(): Entered with (%s)', 1, $ldapserver->server_id);
    }
    # If session hasn't expired yet
    if (isset($_SESSION['activity']['server'][$ldapserver->server_id])) {
        # If $session_timeout not defined, use (session_cache_expire() - 1)
        if (!isset($ldapserver->session_timeout)) {
            $session_timeout = session_cache_expire() - 1;
        } else {
            $session_timeout = $ldapserver->session_timeout;
        }
        # Get the $last_activity and $rightframe_server_id value
        $last_activity = $_SESSION['activity']['server'][$ldapserver->server_id];
        # If diff between current time and last activity greater than $session_timeout, log out user
        if (time() - $last_activity > $session_timeout * 60) {
            if (in_array($ldapserver->auth_type, array('cookie', 'session'))) {
                syslog_notice('Logout for ' . $ldapserver->getLoggedInDN());
                $ldapserver->unsetLoginDN() or pla_error(_('Could not logout.'));
            }
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:SalokineTerata,项目名称:intranet,代码行数:37,代码来源:timeout_functions.php

示例13: __new__

 /**
  * セッションを開始する
  * @param string $name
  * @return $this
  */
 protected function __new__($name = 'sess')
 {
     $this->ses_n = $name;
     if ('' === session_id()) {
         $session_name = \org\rhaco\Conf::get('session_name', 'SID');
         if (!ctype_alpha($session_name)) {
             throw new \InvalidArgumentException('session name is is not a alpha value');
         }
         session_cache_limiter(\org\rhaco\Conf::get('session_limiter', 'nocache'));
         session_cache_expire((int) (\org\rhaco\Conf::get('session_expire', 10800) / 60));
         session_name();
         if (static::has_module('session_read')) {
             ini_set('session.save_handler', 'user');
             session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($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,项目名称:rhaco3,代码行数:31,代码来源:Session.php

示例14: start

 /**
  * Inicia a sessão no php
  */
 public static function start($Module = null)
 {
     if (!session_id()) {
         $config = get_config('project');
         self::$_SESSION_ = $config['name'];
         $path = ABSPATH . '/temp/session';
         if (!file_exists($path)) {
             mkdir($path, 0777);
             chmod($path, 0777);
         }
         if ($Module) {
             $path .= '/' . $Module;
             if (!file_exists($path)) {
                 mkdir($path, 0777);
                 chmod($path, 0777);
             }
         }
         session_cache_expire($config['sessiontime']);
         session_save_path($path);
         session_start();
         # Iniciando array
         if (!isset($_SESSION[self::$_SESSION_])) {
             $_SESSION[self::$_SESSION_] = [];
         }
     }
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:29,代码来源:Session.class.php

示例15: config

 public static function config($name)
 {
     // 如果设置了前缀,则替换conf
     if (isset($name['prefix'])) {
         C('SESSION_PREFIX', $name['prefix']);
     }
     // 根据默认值设置获得根据定义的id设置
     if (C('VAR_SESSION_ID') && isset($_REQUEST[C('VAR_SESSION_ID')])) {
         session_id($_REQUEST[C('VAR_SESSION_ID')]);
     } elseif (isset($name['id'])) {
         session_id($name['id']);
     }
     // session 函数参考,http://www.php.net/manual/zh/ref.session.php
     // session runtime 配置参考,http://www.php.net/manual/zh/session.configuration.php
     ini_set('session.auto_start', 0);
     if (isset($name['name'])) {
         session_name($name['name']);
     }
     if (isset($name['path'])) {
         session_save_path($name['path']);
     }
     if (isset($name['domain'])) {
         ini_set('session.cookie_domain', $name['domain']);
     }
     if (isset($name['expire'])) {
         ini_set('session.gc_maxlifetime', $name['expire']);
     }
     if (isset($name['use_trans_sid'])) {
         ini_set('session.use_trans_sid', $name['use_trans_sid'] ? 1 : 0);
     }
     if (isset($name['use_cookies'])) {
         ini_set('session.use_cookies', $name['use_cookies'] ? 1 : 0);
     }
     if (isset($name['cache_limiter'])) {
         session_cache_limiter($name['cache_limiter']);
     }
     if (isset($name['cache_expire'])) {
         session_cache_expire($name['cache_expire']);
     }
     if (isset($name['type'])) {
         C('SESSION_TYPE', $name['type']);
     }
     // 如果存在其他session类型
     if (C('SESSION_TYPE')) {
         // 读取session驱动
         $class = 'Session' . ucwords(strtolower(C('SESSION_TYPE')));
         // 检查驱动类是否存在并加载,不存在则抛出错误
         if (Import::load(EXTEND_PATH . 'Driver/Session/' . $class . '.class.php')) {
             $hander = new $class();
             $hander->execute();
         } else {
             // 类没有定义
             Debug::throw_exception(L('_CLASS_NOT_EXIST_') . ': ' . $class);
         }
     }
     // 启动session
     if (C('SESSION_AUTO_START')) {
         session_start();
     }
 }
开发者ID:minowu,项目名称:smartthink,代码行数:60,代码来源:Session.php


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