
在WordPress中重写URL的一些提示和插件
wp_filesize ( $path )
wp_filesize: 这个函数用来将文件大小的字节格式化为更可读的格式,如千字节、兆字节等。它接收以字节为单位的文件大小作为参数,并返回格式化后的大小。
带有过滤器的PHP文件大小的封装器,并将结果铸成整数。
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 ); }