status_header
函数
status_header ( $code, $description = '' )
- 参数
-
-
(int)
$code
HTTP status code.- Required: 是
-
(string)
$description
Optional. A custom description for the HTTP status.- Required: 否
- Default: (empty)
-
(int)
- 相关
-
- get_status_header_desc()
- 定义位置
-
-
wp-includes/functions.php
, line 1444
-
wp-includes/functions.php
- 引入
- 2.0.0
- 弃用
- –
Sets HTTP status header.
function status_header( $code, $description = '' ) {
if ( ! $description ) {
$description = get_status_header_desc( $code );
}
if ( empty( $description ) ) {
return;
}
$protocol = wp_get_server_protocol();
$status_header = "$protocol $code $description";
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 $description Description for the status code.
* @param string $protocol Server protocol.
*/
$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
}
if ( ! headers_sent() ) {
header( $status_header, true, $code );
}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


