add_magic_quotes

函数


add_magic_quotes ( $array )
参数
  • (array)
    $array
    Array to walk while sanitizing contents.
    Required:
返回值
  • (array) Sanitized $array.
定义位置
  • wp-includes/functions.php
    , line 1275
引入
0.71
弃用

Walks the array while sanitizing the contents.

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;
}