status_header()
status_header( int $code, string $description = ” ) 设置H…
status_header( int $code, string $description = ” )
设置HTTP状态标头。
Set HTTP status header.
设置HTTP状态标头。
Set HTTP status header.
目录锚点:#说明#参数#源码
说明(Description)
另请参阅get_status_header_desc()
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $code | (int) | HTTP状态代码。 |
| $description | (string) | HTTP状态的自定义描述。 |
源码(Source)
/**
* Set HTTP status header.
*
* @since 2.0.0
*
* @see get_status_header_desc()
*
* @param int $code HTTP status code.
*/
function status_header( $code ) {
$description = get_status_header_desc( $code );
if ( empty( $description ) )
return;
$protocol = $_SERVER['SERVER_PROTOCOL'];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
$protocol = 'HTTP/1.0';
$status_header = "$protocol $code $description";
if ( function_exists( 'apply_filters' ) )
/**
* Filter 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 );
@header( $status_header, true, $code );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 4.4.0 | wp-includes/functions.php | 10 | 12 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。




还没有任何评论,赶紧来占个楼吧!