WordPress开发者和主题制作者的搜索引擎



wp_get_server_protocol ›

Since4.4.0
已弃用n/a
wp_get_server_protocol ( 没有参数 )
返回:
  • (string) The HTTP protocol. Default: HTTP/1.0.
定义在:
文档:

Return the HTTP protocol sent by the server.



源码

function wp_get_server_protocol() {
	$protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
	if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
		$protocol = 'HTTP/1.0';
	}
	return $protocol;
}