wp_register_fatal_error_handler

函式
wp_register_fatal_error_handler ( No parameters )

wp_register_fatal_error_handler – 註冊一個回撥函式來處理WordPress應用程式中的致命錯誤。

為致命的錯誤註冊關閉處理程式。

該處理程式只有在{@see}返回真時才會被註冊。

function wp_register_fatal_error_handler() {
	if ( ! wp_is_fatal_error_handler_enabled() ) {
		return;
	}

	$handler = null;
	if ( defined( 'WP_CONTENT_DIR' ) && is_readable( WP_CONTENT_DIR . '/fatal-error-handler.php' ) ) {
		$handler = include WP_CONTENT_DIR . '/fatal-error-handler.php';
	}

	if ( ! is_object( $handler ) || ! is_callable( array( $handler, 'handle' ) ) ) {
		$handler = new WP_Fatal_Error_Handler();
	}

	register_shutdown_function( array( $handler, 'handle' ) );
}

常見問題

FAQs
檢視更多 >