是的,可以在 PHP 中将 filter_input() 与 AND/OR 结合起来。这可以通过循环 POST 字段来完成 -
$value = filter_input(INPUT_POST, 'field', FILTER_DEFAULT, is_array($_POST['field']) ? FILTER_REQUIRE_ARRAY : NULL);
每个循环的同一用户的等效项如下所示 -
$memory = array(); //looping through all posted values foreach($_POST as $key => $value) { //applying a filter for the array if(is_array($value)) { $ memory [$key] = filter_input(INPUT_POST, $key, {filters for array}); } else { $ memory [$key] = filter_input(INPUT_POST, $key, {filters for scalar}); } }
以上就是能否将PHP的filter_input()过滤器标志与AND/OR结合使用?的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号