status_header() - WordPress 函数参考中文文档

返回介绍

status_header()

发布于 2017-09-11 字数3008 浏览 806 评论 0

status_header( int $code,  string $描述 = '' )

Set HTTP status header.


描述


参数

$code

(int)
(Required)
HTTP status code.

$描述

(string)
(Optional)
A custom 描述 for the HTTP status.

Default value: ”


源代码

File: wp-includes/functions.php

function status_header( $code, $描述 = '' ) {
	if ( ! $描述 ) {
		$描述 = get_status_header_desc( $code );
	}

	if ( empty( $描述 ) ) {
		return;
	}

	$protocol = wp_get_server_protocol();
	$status_header = "$protocol $code $描述";
	if ( function_exists( 'apply_filters' ) )

		/**
		 * Filters an HTTP status header.
		 *
		 * @since 2.2.0
		 *
		 * @param string $status_header HTTP status header.
		 * @param int    $code          HTTP status code.
		 * @param string $描述   描述 for the status code.
		 * @param string $protocol      Server protocol.
		 */
		$status_header = apply_filters( 'status_header', $status_header, $code, $描述, $protocol );

	@header( $status_header, true, $code );
}

更新日志

Version 描述
4.4.0 Added the $描述 parameter.
2.0.0 Introduced.

相关函数

Uses

  • wp-includes/load.php:
    wp_get_server_protocol()
  • wp-includes/functions.php:
    get_status_header_desc()
  • wp-includes/functions.php:
    status_header
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-includes/IXR/class-IXR-server.php:
    IXR_Server::serve()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::ajax_insert_auto_draft_post()
  • wp-includes/customize/class-wp-customize-selective-refresh.php:
    WP_Customize_Selective_Refresh::handle_render_partials_request()
  • wp-includes/embed.php:
    _oembed_rest_pre_serve_request()
  • wp-includes/rest-api/class-wp-rest-server.php:
    WP_REST_Server::set_status()
  • wp-includes/pluggable.php:
    wp_redirect()
  • wp-includes/class-wp.php:
    WP::handle_404()
  • wp-includes/class-wp.php:
    WP::send_headers()
  • wp-includes/functions.php:
    wp_send_json()
  • wp-includes/functions.php:
    dead_db()
  • wp-includes/functions.php:
    _default_wp_die_handler()
  • wp-includes/functions.php:
    _ajax_wp_die_handler()
  • wp-includes/http.php:
    send_origin_headers()
  • Show 8 more used by
    Hide more used by


User Contributed Notes

上一篇:start_wp()

下一篇:sticky_class()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!