如何向filter_input添加选项和标志


How to add an option and a flag to filter_input

如何向filter_put添加选项和标志?PHP文档中说要使用关联数组,但没有给出任何正确语法的示例。我尝试过各种格式,包括以下格式:

$textOpts = filter_input(INPUT_POST, "text", FILTER_SANITIZE_STRING, array("options" => FILTER_FORCE_ARRAY, "flags" => !FILTER_FLAG_ENCODE_LOW));
$textOpts = filter_input(INPUT_POST, "text", FILTER_SANITIZE_STRING, array("options" => array(FILTER_FORCE_ARRAY), "flags" => array(!FILTER_FLAG_ENCODE_LOW)));

我似乎记不清语法,我该怎么写?

<form name="test" id="test" action="" method="POST">
<input type="text" name="demo[]" id="demo[]" value="">
<input type="submit" name="submit-bt" id="submit-bt" value="Submit">
</form>
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$args = array('flags' => FILTER_REQUIRE_ARRAY, 
    'options'   => array('min_range' => 1, 'max_range' => 10)
);
if (!empty($_POST['submit-bt'])){
    $textOpts = filter_input(INPUT_POST, "demo", FILTER_VALIDATE_INT, $args);
    print_R($textOpts);exit;
}
?>