函数原型
add_magic_quotes( array $array ): array
函数描述
Walks the array while sanitizing the contents.
是否弃用
未弃用
函数参数
-
$array
array
Required - Array to walk while sanitizing contents.
函数返回值
array Sanitized $array.
函数位置
File: wp-includes/functions.php.
函数源码
function add_magic_quotes( $array ) {
foreach ( (array) $array as $k => $v ) {
if ( is_array( $v ) ) {
$array[ $k ] = add_magic_quotes( $v );
} elseif ( is_string( $v ) ) {
$array[ $k ] = addslashes( $v );
} else {
continue;
}
}
return $array;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.5.0 | Non-string values are left untouched. |
| 0.71 | Introduced. |

