本文整理汇总了PHP中storage::recover_variables方法的典型用法代码示例。如果您正苦于以下问题:PHP storage::recover_variables方法的具体用法?PHP storage::recover_variables怎么用?PHP storage::recover_variables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类storage
的用法示例。
在下文中一共展示了storage::recover_variables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wiki_param
/**
* gets/sets a wiki_param variable. Also can execute some special actions
* over a wiki_param (defined by $special param):
* 'unset' => unsets a wiki_param
* 'print' or 'print_object': do a print_object of a wiki_param
* 'isset' => will returns only true or false if a wiki_param is set
* 'set_info' => load main info into global structure
* 'all_ws' => (deprecated) returns all variables in a single object
*
* @param String $name: wiki_param name
* @param mixed $value=null: assign wiki_param value
* @param Stirng $special=false: some special actions
* @return mixed: wiki_param value or null if it's not set
*/
function wiki_param($name, $value = null, $special = false)
{
global $WS;
if (!isset($WS)) {
$WS = new storage();
$WS->recover_variables();
}
if ($special == 'set_info') {
$WS->set_info();
}
//this is a deprecated line and will be removed shortly
if ($special == 'all_ws') {
return $WS;
}
if (!$name) {
return null;
}
if ($value !== null) {
$WS->{$name} = $value;
}
//special actions
switch ($special) {
case 'isset':
return isset($WS->{$name});
break;
case 'unset':
if (isset($WS->{$name})) {
unset($WS->{$name});
}
break;
case 'print':
case 'print_object':
if (isset($WS->{$name})) {
print_object();
} else {
echo '$WS->' . $name . ' is not set!';
}
break;
}
if (!isset($WS->{$name})) {
return null;
}
return $WS->{$name};
}