wp_filesize
函数
      wp_filesize ( $path )    
  - 参数
 - 
- 
                (string)
$path
Path to the file.- Required: 是
 
 
 - 
                (string)
 
- 返回值
 - 
- (int) The size of the file in bytes, or 0 in the event of an error.
 
 
- 定义位置
 - 
- 
                                  wp-includes/functions.php
, line 3495 
 - 
                                  wp-includes/functions.php
 
- 引入
 - 6.0.0
 
- 弃用
 - –
 
Wrapper for PHP filesize with filters and casting the result as an integer.
function wp_filesize( $path ) {
	/**
	 * Filters the result of wp_filesize before the PHP function is run.
	 *
	 * @since 6.0.0
	 *
	 * @param null|int $size The unfiltered value. Returning an int from the callback bypasses the filesize call.
	 * @param string   $path Path to the file.
	 */
	$size = apply_filters( 'pre_wp_filesize', null, $path );
	if ( is_int( $size ) ) {
		return $size;
	}
	$size = file_exists( $path ) ? (int) filesize( $path ) : 0;
	/**
	 * Filters the size of the file.
	 *
	 * @since 6.0.0
	 *
	 * @param int    $size The result of PHP filesize on the file.
	 * @param string $path Path to the file.
	 */
	return (int) apply_filters( 'wp_filesize', $size, $path );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。