wp_exif_date2ts

函数
wp_exif_date2ts ( $str )
参数
  • (string) $str A date string expected to be in Exif format (Y:m:d H:i:s).
    Required:
返回值
  • (int|false) The unix timestamp, or false on failure.
定义位置
相关方法
wp_exif_frac2decwp_datewp_ext2typewp_get_update_datawp_ajax_date_format
引入
2.5.0
弃用
-

wp_exif_date2ts: 这个函数用于将WordPress中的EXIF日期转换成Unix时间戳。EXIF是一种元数据格式,通常用于数码摄影: 这个函数接收一个EXIF日期字符串作为输入,并返回一个Unix时间戳。

将exif的日期格式转换为unix的时间戳。

function wp_exif_date2ts( $str ) {
	list( $date, $time ) = explode( ' ', trim( $str ) );
	list( $y, $m, $d )   = explode( ':', $date );

	return strtotime( "{$y}-{$m}-{$d} {$time}" );
}

常见问题

FAQs
查看更多 >