wpseek.com
WordPress开发者和主题制作者的搜索引擎
_validate_cache_id › WordPress Function
Since6.3.0
已弃用n/a
› _validate_cache_id ( $object_id )
参数: |
|
返回: |
|
定义在: |
|
文档: |
Checks whether the given cache ID is either an integer or an integer-like string.
Both16
and "16"
are considered valid, other numeric types and numeric strings
(16.3
and "16.3"
) are considered invalid.Related Functions: validate_email, wp_validate_auth_cookie, validate_active_plugins, wp_validate_site_data, validate_file
源码
function _validate_cache_id( $object_id ) { /* * filter_var() could be used here, but the `filter` PHP extension * is considered optional and may not be available. */ if ( is_int( $object_id ) || ( is_string( $object_id ) && (string) (int) $object_id === $object_id ) ) { return true; } /* translators: %s: The type of the given object ID. */ $message = sprintf( __( 'Object ID must be an integer, %s given.' ), gettype( $object_id ) ); _doing_it_wrong( '_get_non_cached_ids', $message, '6.3.0' ); return false; }