本文整理汇总了PHP中Zend_Session::_defaultOptionsSet方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::_defaultOptionsSet方法的具体用法?PHP Zend_Session::_defaultOptionsSet怎么用?PHP Zend_Session::_defaultOptionsSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::_defaultOptionsSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOptions
/**
* setOptions - set both the class specified
*
* @param array $userOptions - pass-by-keyword style array of <option name, option value> pairs
* @throws Zend_Session_Exception
* @return void
*/
public static function setOptions(array $userOptions = array())
{
// set default options on first run only (before applying user settings)
if (!self::$_defaultOptionsSet) {
foreach (self::$_defaultOptions as $defaultOptionName => $defaultOptionValue) {
if (isset(self::$_defaultOptions[$defaultOptionName])) {
ini_set("session.{$defaultOptionName}", $defaultOptionValue);
}
}
self::$_defaultOptionsSet = true;
}
// set the options the user has requested to set
foreach ($userOptions as $userOptionName => $userOptionValue) {
$userOptionName = strtolower($userOptionName);
// set the ini based values
if (array_key_exists($userOptionName, self::$_defaultOptions)) {
ini_set("session.{$userOptionName}", $userOptionValue);
} elseif (isset(self::$_localOptions[$userOptionName])) {
self::${self::$_localOptions[$userOptionName]} = $userOptionValue;
} else {
/** @see Zend_Session_Exception */
// require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception("Unknown option: {$userOptionName} = {$userOptionValue}");
}
}
}
示例2: setOptions
/**
* setOptions - set both the class specified
*
* @param array $userOptions - pass-by-keyword style array of <option name, option value> pairs
* @throws Zend_Session_Exception
* @return void
*/
public static function setOptions(array $userOptions = array())
{
// set default options on first run only (before applying user settings)
if (!self::$_defaultOptionsSet) {
foreach (self::$_defaultOptions as $default_option_name => $default_option_value) {
if (isset(self::$_defaultOptions[$default_option_name])) {
ini_set('session.' . $default_option_name, $default_option_value);
}
}
self::$_defaultOptionsSet = true;
}
// set the options the user has requested to set
foreach ($userOptions as $user_option_name => $user_option_value) {
$user_option_name = strtolower($user_option_name);
// set the ini based values
if (array_key_exists($user_option_name, self::$_defaultOptions)) {
ini_set('session.' . $user_option_name, $user_option_value);
} elseif (isset(self::$_localOptions[$user_option_name])) {
self::${self::$_localOptions[$user_option_name]} = $user_option_value;
} else {
throw new Zend_Session_Exception("Unknown option: {$user_option_name} = {$user_option_value}");
}
}
$savePath = ini_get('session.save_path');
if (strpos($savePath, ';')) {
$savePath = explode(';', $savePath);
$savePath = realpath(array_pop($savePath));
}
if (!is_writable($savePath)) {
throw new Zend_Session_Exception("Unwritable session.save_path: {$savePath}");
}
}
示例3: writeClose
/**
* writeClose() - Shutdown the sesssion, close writing and detach $_SESSION from the back-end storage mechanism.
* This will complete the internal data transformation on this request.
*
* @param bool $readonly - OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)
* @return void
*/
public static function writeClose($readonly = true)
{
if (self::$_writeClosed) {
return;
}
if ($readonly) {
parent::$_writable = false;
}
if (!self::$_unitTestEnabled) {
session_write_close();
session_id('');
}
session_write_close();
self::$_writeClosed = true;
self::$_sessionStarted = false;
self::$_defaultOptionsSet = false;
}
示例4: setOptions
/**
* setOptions - set both the class specified
*
* @param array $userOptions - pass-by-keyword style array of <option name, option value> pairs
* @throws Zend_Session_Exception
* @return void
*/
public static function setOptions(array $userOptions = array())
{
// set default options on first run only (before applying user settings)
if (!self::$_defaultOptionsSet) {
foreach (self::$_defaultOptions as $default_option_name => $default_option_value) {
if (isset(self::$_defaultOptions[$default_option_name]) && $default_option_value !== null) {
ini_set('session.' . $default_option_name, $default_option_value);
}
}
self::$_defaultOptionsSet = true;
}
// set the options the user has requested to set
foreach ($userOptions as $user_option_name => $user_option_value) {
$user_option_name = strtolower($user_option_name);
// set the ini based values
if (array_key_exists($user_option_name, self::$_defaultOptions)) {
ini_set('session.' . $user_option_name, $user_option_value);
} elseif (isset(self::$_localOptions[$user_option_name])) {
self::${self::$_localOptions[$user_option_name]} = $user_option_value;
} else {
throw new Zend_Session_Exception("Unknown option: {$user_option_name} = {$user_option_value}");
}
}
}