Home  >  Article  >  Backend Development  >  递归处理数组的有关问题请问

递归处理数组的有关问题请问

WBOY
WBOYOriginal
2016-06-13 12:15:02844browse

递归处理数组的问题请教
由于在PHP5.4.3以上,PHP不再支持magic_quotes_gpc功能,所以想直接透过
if (PHP_VERSION >= 5.4 || !get_magic_quotes_gpc())
{
$_REQUEST = array_map( 'addslashes', $_REQUEST);
$_POST = array_map( 'addslashes', $_POST);
$_GET = array_map( 'addslashes', $_GET);
}
来解决用户提交数据中的',‘’问题,但发现array_map函数无法解决递归的问题,如果控件名称是多个同名的,类似ck[],而
采用array_walk_recursive,又回提示Fatal error: Call-time pass-by-reference has been removed ,请问PHP5.4.3以上版本可有函数解决这个问题
------解决思路----------------------
http://bbs.csdn.net/topics/390936241

可以参考下
------解决思路----------------------

array_walk_recursive($_POST, function(&$v) { $v = addslashes($v); });<br />
其他类同

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn