本文整理汇总了PHP中arr::merge_recursive_distinct方法的典型用法代码示例。如果您正苦于以下问题:PHP arr::merge_recursive_distinct方法的具体用法?PHP arr::merge_recursive_distinct怎么用?PHP arr::merge_recursive_distinct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arr
的用法示例。
在下文中一共展示了arr::merge_recursive_distinct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$preserve = array('_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION');
foreach ($preserve as $input) {
if (!isset($GLOBALS[$input])) {
continue;
}
$this->unfiltered_inputs[strtolower($input)] = $GLOBALS[$input];
}
parent::__construct();
// loop each of the request vars
foreach ($_REQUEST as $key => $value) {
// if we find a var that begins with __ that is a marker for a
// checkbox
if (substr($key, 0, 2) == '__') {
// setup and array removing the __ in the key
$uncheckedValue = array(substr($key, 2) => $value);
// merge this into the request array, NOT replacing any existing value
$_REQUEST = arr::merge_recursive_distinct($uncheckedValue, $_REQUEST);
// remove our temporary tracker
unset($_REQUEST[$key]);
// see if this var came from a post
if (array_key_exists($key, $_POST)) {
// merge this into the post array, NOT replacing any existing value
$_POST = arr::merge_recursive_distinct($uncheckedValue, $_POST);
unset($_POST[$key]);
}
// see if this var came from a get
if (array_key_exists($key, $_GET)) {
// merge this into the get array, NOT replacing any existing value
$_GET = arr::merge_recursive_distinct($uncheckedValue, $_GET);
unset($_GET[$key]);
}
}
}
}