本文整理匯總了PHP中FabrikHelperHTML::requestHeaders方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::requestHeaders方法的具體用法?PHP FabrikHelperHTML::requestHeaders怎麽用?PHP FabrikHelperHTML::requestHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::requestHeaders方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseRequestHeaders
/**
* Build an array of the request headers by hand. Replacement for using
* apache_request_headers(), which only works in certain configurations.
* This solution gets them from the $_SERVER array, and re-munges them back
* from HTTP_FOO_BAR format to Foo-Bar format. Stolen from:
* http://stackoverflow.com/questions/541430/how-do-i-read-any-request-header-in-php
*
* @return array request headers assoc
*/
public static function parseRequestHeaders()
{
if (isset(self::$requestHeaders)) {
return self::$requestHeaders;
}
self::$requestHeaders = array();
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 5) != 'HTTP_') {
continue;
}
$header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
self::$requestHeaders[$header] = $value;
}
return self::$requestHeaders;
}