'ec"'">
时间:2021-07-01 10:21:17 帮助过:8人阅读
";';
print_r($arr);
echo '
$arr=array('ii"',array('one'=>'ec"','two'=>5),'aa"a');
function t(& $arr){
foreach($arr as $k => $v){
if(is_string($v)){
$arr[$k] = addslashes($v);
}else{
$arr[$k] = t($v);
}
}
return $arr;
}
t($arr);
echo "";';
print_r($arr);
echo '
$arr = array('ii"',array('one'=>"ec'",'two'=>5));
array_walk_recursive($arr, function(&$v) { $v = addslashes($v);} );
print_r($arr);
Array
(
[0] => ii\"
[1] => Array
(
[one] => ec\'
[two] => 5
)
)
function t(&$arr){
foreach($arr as $key=>$v){
if(is_string($v)){
$arr[$key]=addslashes($v);
}else{
t($arr[$key]);
}
}
}
function t(&$arr){
foreach($arr as $key=>$v){
if(is_array($v)){
t($arr[$key]);
}else{
$arr[$key]=addslashes($v);
}
}
}
$arr=array('ii"',array('one'=>'ec"','two'=>'5'));
t($arr);
print_r($arr);