本文整理汇总了PHP中Slim\Http\Headers::createFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Headers::createFromArray方法的具体用法?PHP Headers::createFromArray怎么用?PHP Headers::createFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Http\Headers
的用法示例。
在下文中一共展示了Headers::createFromArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeServerRequest
/**
* @param array $serverParams
* @return ServerRequest
*/
public function makeServerRequest(array $serverParams)
{
// I have no idea why I need to type hint here, but phpstorm is complaining
/** @var $serverRequest ServerRequest */
$headers = Headers::createFromArray($serverParams);
$cookies = Cookies::parseHeader($headers->get('Cookie', []));
$serverRequest = new ServerRequest($serverParams, $cookies);
$serverRequest = $serverRequest->withMethod($serverParams['REQUEST_METHOD']);
$serverRequest = $serverRequest->withUri();
foreach ($headers->all() as $header => $value) {
$serverRequest = $serverRequest->withHeader($header, $value);
}
$serverRequest = $serverRequest->withUploadedFiles(UploadedFile::parseUploadedFiles($_FILES));
return $serverRequest;
}