wp_max_upload_size

函式
wp_max_upload_size ( No parameters )
返回值
  • (int) Allowed upload size.
定義位置
相關方法
wp_upload_dirwp_get_upload_dircheck_upload_sizemedia_upload_filewp_upload_bits
引入
2.5.0
棄用
-

wp_max_upload_size: 這是一個函式,返回伺服器上允許的最大檔案上傳尺寸。

決定了php.ini中允許的最大上傳尺寸。

function wp_max_upload_size() {
	$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
	$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );

	/**
	 * Filters the maximum upload size allowed in php.ini.
	 *
	 * @since 2.5.0
	 *
	 * @param int $size    Max upload size limit in bytes.
	 * @param int $u_bytes Maximum upload filesize in bytes.
	 * @param int $p_bytes Maximum size of POST data in bytes.
	 */
	return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
}

常見問題

FAQs
檢視更多 >