wp_is_ini_value_changeable

函数
wp_is_ini_value_changeable ( $setting )
参数
  • (string) $setting The name of the ini setting to check.
    Required:
返回值
  • (bool) True if the value is changeable at runtime. False otherwise.
定义位置
相关方法
wp_revisions_enabledwp_is_fatal_error_handler_enabled_wp_sidebars_changedwp_iso_descramblerwp_skip_paused_themes
引入
4.6.0
弃用
-

wp_is_ini_value_changeable: 这个函数用来检查一个PHP配置值是否可以在运行时改变。它把一个配置参数作为参数,如果可以改变则返回true,否则返回false。

决定一个PHP ini值是否可以在运行时改变。

function wp_is_ini_value_changeable( $setting ) {
	static $ini_all;

	if ( ! isset( $ini_all ) ) {
		$ini_all = false;
		// Sometimes `ini_get_all()` is disabled via the `disable_functions` option for "security purposes".
		if ( function_exists( 'ini_get_all' ) ) {
			$ini_all = ini_get_all();
		}
	}

	// Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17.
	if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) {
		return true;
	}

	// If we were unable to retrieve the details, fail gracefully to assume it's changeable.
	if ( ! is_array( $ini_all ) ) {
		return true;
	}

	return false;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 14:32:54

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: