函数原型
file_is_valid_image( string $path ): bool
函数描述
Validates that file is an image.
是否弃用
未弃用
函数参数
-
$path
string
Required - File path to test if valid image.
函数返回值
bool True if valid image, false if not valid image.
函数位置
File: wp-admin/includes/image.php.
函数源码
function file_is_valid_image( $path ) {
$size = wp_getimagesize( $path );
return ! empty( $size );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |

