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


PHP JSessionStorage::read方法代码示例

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


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

示例1: fork

 /**
  * Create a new session and copy variables from the old one
  *
  * @return  boolean $result true on success
  *
  * @since   11.1
  */
 public function fork()
 {
     if ($this->_state !== 'active') {
         return false;
     }
     // Keep the old values
     $values = $_SESSION;
     $trans = ini_get('session.use_trans_sid');
     if ($trans) {
         ini_set('session.use_trans_sid', 0);
     }
     $cookie = session_get_cookie_params();
     // Generate a new ID
     session_regenerate_id(true);
     $id = session_id();
     $data = $this->_store->read($this->getId());
     // Kill the session
     session_destroy();
     // Re-register the session store after a session has been destroyed, to avoid PHP bug
     $this->_store->register();
     // Restore config
     ini_set('session.use_trans_sid', $trans);
     session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure']);
     // Restart session with new id
     session_id($id);
     session_start();
     $_SESSION = $values;
     // Now put the session data back
     $this->_store->write($id, $data);
 }
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:37,代码来源:session.php

示例2: __construct

 /**
  * Constructor
  *
  * @param   string  $store    The type of storage for the session.
  * @param   array   $options  Optional parameters
  *
  * @since   11.1
  */
 public function __construct($store = 'none', $options = array())
 {
     // Need to destroy any existing sessions started with session.auto_start
     if (session_id()) {
         session_unset();
         session_destroy();
     }
     // Set default sessios save handler
     ini_set('session.save_handler', 'files');
     // Disable transparent sid support
     ini_set('session.use_trans_sid', '0');
     if ($store == 'database') {
         if (ini_get('session.gc_probability') < 1) {
             ini_set('session.gc_probability', 1);
         }
         if (ini_get('session.gc_divisor') < 1) {
             ini_set('session.gc_divisor', 100);
         }
     }
     // Create handler
     $this->_store = JSessionStorage::getInstance($store, $options);
     // Set options
     $this->_setOptions($options);
     /* BEGIN: HUBzero Extension to pass session id in query string when cookie not available */
     /* This is used, in particular, to allow QuickTime plugin in Safari on the Mac */
     /* to view private mp4. QuickTime does not pass the browser's cookies to the site */
     if (!isset($_COOKIE[session_name()]) && isset($_GET['PHPSESSID'])) {
         if (strlen($_GET['PHPSESSID']) == 32 && ctype_alnum($_GET['PHPSESSID'])) {
             if ($this->_store->read($_GET['PHPSESSID']) != '') {
                 session_id($_GET['PHPSESSID']);
             }
         }
     }
     /* END: HUBzero Extension to pass session id in query string when cookie not available */
     $this->_setCookieParams();
     // Load the session
     $this->_start();
     // Initialise the session
     $this->_setCounter();
     $this->_setTimers();
     $this->_state = 'active';
     // Perform security checks
     $this->_validate();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:52,代码来源:session.php


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