PHP 클래스 Zend\Diactoros\ServerRequestFactory

Logic largely refactored from the ZF2 Zend\Http\PhpEnvironment\Request class.
파일 보기 프로젝트 열기: zendframework/zend-diactoros 1 사용 예제들

공개 메소드들

메소드 설명
fromGlobals ( array $server = null, array $query = null, array $body = null, array $cookies = null, array $files = null ) : ServerRequest Create a request from the supplied superglobal values.
get ( string $key, array $values, mixed $default = null ) : mixed Access a value in an array, returning a default value if not found
getHeader ( string $header, array $headers, mixed $default = null ) : string Search for a header value.
marshalHeaders ( array $server ) : array Marshal headers from $_SERVER
marshalHostAndPortFromHeaders ( stdClass $accumulator, array $server, array $headers ) Marshal the host and port from HTTP headers and/or the PHP environment
marshalRequestUri ( array $server ) : string Detect the base URI for the request
marshalUriFromServer ( array $server, array $headers ) : Uri Marshal the URI from the $_SERVER array and headers
normalizeFiles ( array $files ) : array Normalize uploaded files
normalizeServer ( array $server ) : array Marshal the $_SERVER array
stripQueryString ( mixed $path ) : string Strip the query string from a path

비공개 메소드들

메소드 설명
createUploadedFileFromSpec ( array $value ) : array | Psr\Http\Message\UploadedFileInterface Create and return an UploadedFile instance from a $_FILES specification.
marshalHostAndPortFromHeader ( stdClass $accumulator, string | array $host ) : void Marshal the host and port from the request header
marshalIpv6HostAndPort ( stdClass $accumulator, array $server ) Marshal host/port from misinterpreted IPv6 address
marshalProtocolVersion ( array $server ) : string Return HTTP protocol version (X.Y)
normalizeNestedFileSpec ( array $files = [] ) : Psr\Http\Message\UploadedFileInterface[] Normalize an array of file specifications.

메소드 상세

fromGlobals() 공개 정적인 메소드

If any argument is not supplied, the corresponding superglobal value will be used. The ServerRequest created is then passed to the fromServer() method in order to marshal the request URI and headers.
또한 보기: fromServer()
public static fromGlobals ( array $server = null, array $query = null, array $body = null, array $cookies = null, array $files = null ) : ServerRequest
$server array $_SERVER superglobal
$query array $_GET superglobal
$body array $_POST superglobal
$cookies array $_COOKIE superglobal
$files array $_FILES superglobal
리턴 ServerRequest

get() 공개 정적인 메소드

Will also do a case-insensitive search if a case sensitive search fails.
public static get ( string $key, array $values, mixed $default = null ) : mixed
$key string
$values array
$default mixed
리턴 mixed

getHeader() 공개 정적인 메소드

Does a case-insensitive search for a matching header. If found, it is returned as a string, using comma concatenation. If not, the $default is returned.
public static getHeader ( string $header, array $headers, mixed $default = null ) : string
$header string
$headers array
$default mixed
리턴 string

marshalHeaders() 공개 정적인 메소드

Marshal headers from $_SERVER
public static marshalHeaders ( array $server ) : array
$server array
리턴 array

marshalHostAndPortFromHeaders() 공개 정적인 메소드

Marshal the host and port from HTTP headers and/or the PHP environment
public static marshalHostAndPortFromHeaders ( stdClass $accumulator, array $server, array $headers )
$accumulator stdClass
$server array
$headers array

marshalRequestUri() 공개 정적인 메소드

Looks at a variety of criteria in order to attempt to autodetect a base URI, including rewrite URIs, proxy URIs, etc. From ZF2's Zend\Http\PhpEnvironment\Request class
public static marshalRequestUri ( array $server ) : string
$server array
리턴 string

marshalUriFromServer() 공개 정적인 메소드

Marshal the URI from the $_SERVER array and headers
public static marshalUriFromServer ( array $server, array $headers ) : Uri
$server array
$headers array
리턴 Uri

normalizeFiles() 공개 정적인 메소드

Transforms each value into an UploadedFileInterface instance, and ensures that nested arrays are normalized.
public static normalizeFiles ( array $files ) : array
$files array
리턴 array

normalizeServer() 공개 정적인 메소드

Pre-processes and returns the $_SERVER superglobal.
public static normalizeServer ( array $server ) : array
$server array
리턴 array

stripQueryString() 공개 정적인 메소드

Strip the query string from a path
public static stripQueryString ( mixed $path ) : string
$path mixed
리턴 string