thinkphp过滤post提交过来的数组(获取不到post过来的checkbox值)

来源:互联网 发布:淘宝返利什么意思 编辑:程序博客网 时间:2024/05/16 03:31

1./Lib/Core/App.class.php Line:58

if(C('VAR_FILTERS')) {            $filters    =   explode(',',C('VAR_FILTERS'));            foreach($filters as $filter){                // 全局参数过滤                $_POST  =   array_map($filter,$_POST);                $_GET   =   array_map($filter,$_GET);            }        }
这里array_map 函数调用htmlspecialchars函数过滤时会将数组过滤掉

应该用array_walk_recursive函数,如果参数变量还是个数组,它会递归调用函数,故能解决此问题。

if(C('VAR_FILTERS')) {            $filters    =   explode(',',C('VAR_FILTERS'));            foreach($filters as $filter){                // 全局参数过滤                array_walk_recursive($_POST, $filter);                array_walk_recursive($_GET, $filter);            }        }


1 0