stripslashes_deep()
stripslashes_deep( mixed $value )
在数组、对象或标量之间导航,并从值中删除斜杠。
Navigates through an array, object, or scalar, and removes slashes from the values.
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$value | (mixed) | 要剥离的值。 |
源码(Source)
/** * Navigates through an array and removes slashes from the values. * * If an array is passed, the array_map() function causes a callback to pass the * value back to the function. The slashes from this value will removed. * * @since 2.0.0 * * @param mixed $value The value to be stripped. * @return mixed Stripped value. */ function stripslashes_deep( $value ) { if ( is_array($value) ) { $value = array_map('stripslashes_deep', $value); } elseif ( is_object($value) ) { $vars = get_object_vars( $value ); foreach ($vars as $key=>$data) { $value->{$key} = stripslashes_deep( $data ); } } elseif ( is_string( $value ) ) { $value = stripslashes($value); } return $value; }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.0.0 | wp-includes/formatting.php | 2 | 16 |
笔记(Notes)
良好的编码实践
stripslashes_deep() 为WP2原创文章,链接:https://www.wp2.cn/functions/stripslashes_deep/