本文整理汇总了PHP中Env::variables_def方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::variables_def方法的具体用法?PHP Env::variables_def怎么用?PHP Env::variables_def使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::variables_def方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* init the globals variables, by reading the given
* array which describes all this variables
*
* each build options item should be an array
* 0: help (or false for hidden options)
* 1: the default value (string)
* 2: a preg expression to verify the given value
* or
* 1: a boolean, which indicates that the option is a boolean value
* the value of this boolean is the default value
* 2: no value
* @param array $build_options the options to create as globals variables
*/
public static function init($build_options)
{
self::$variables_def = $build_options;
foreach ($build_options as $name => $def) {
// if there isn't a defined default value,
// let's defining an empty string as default value
if (!isset($def[1])) {
self::$variables_def[$name][1] = '';
}
// if the default value is not a boolean, and if there isn't a third
// parameter in the array, let's define a third parameter
if (!isset($def[2]) && !is_bool(self::$variables_def[$name][1])) {
self::$variables_def[$name][2] = '';
}
self::storeValue($name, self::$variables_def[$name][1]);
}
}