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


PHP fSession::key_prefix方法代码示例

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


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

示例1: setBackend

 /**
  * Sets an fCache object to store sessions in
  * 
  * While any type of fCache backend should technically work, it would be
  * unwise to use the `file` and `directory` types. The `file` caching
  * backend stores all values in a single file, which would quickly become a
  * performance bottleneck and could cause data loss with many concurrent
  * users. The `directory` caching backend would not make sense since it is
  * the same general functionality as the default session handler, but it
  * would be slightly slower since it is written in PHP and not C.
  *
  * It is recommended to set the `serializer` and `unserializer` `$config`
  * settings on the fCache object to `string` for the best performance and
  * minimal storage space.
  *
  * For better performance, check out using the built-in session handlers
  * that are bundled with the following extensions:
  *
  *  - [http://php.net/memcached.sessions memcached]
  *  - [http://php.net/memcache.examples-overview#example-3596 memcache]
  *  - [https://github.com/nicolasff/phpredis redis]
  *
  * The [http://pecl.php.net/package/igbinary igbinary] extension can
  * provide even more of a performance boost by storing serialized data in
  * binary format instead of as text.
  * 
  * @param  fCache $backend     An fCache object to store session values in
  * @param  string $key_prefix  A prefix to add to all session IDs before storing them in the cache
  * @return void
  */
 public static function setBackend($backend, $key_prefix = '')
 {
     if (self::$open || isset($_SESSION)) {
         throw new fProgrammerException('%1$s must be called before any of %2$s, %3$s, %4$s, %5$s, %6$s, %7$s or %8$s', __CLASS__ . '::setLength()', __CLASS__ . '::add()', __CLASS__ . '::clear()', __CLASS__ . '::enablePersistence()', __CLASS__ . '::get()', __CLASS__ . '::open()', __CLASS__ . '::set()', 'session_start()');
     }
     self::$old_session_module_name = session_module_name();
     self::$backend = $backend;
     self::$key_prefix = $key_prefix;
     session_set_save_handler(array('fSession', 'openCache'), array('fSession', 'closeCache'), array('fSession', 'readCache'), array('fSession', 'writeCache'), array('fSession', 'destroyCache'), array('fSession', 'gcCache'));
     // This ensures the session is closed before the fCache object is destructed
     register_shutdown_function(array('fSession', 'close'));
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:42,代码来源:fSession.php


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