Added convenience function to read from header
This commit is contained in:
parent
cc5474ef80
commit
48bf5f1e67
@ -125,6 +125,22 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getHeader($strKey)
|
||||||
|
{
|
||||||
|
if (is_array($_SERVER))
|
||||||
|
{
|
||||||
|
$strHeaderKey = "HTTP_{$strKey}";
|
||||||
|
$strHeaderKey = strtoupper($strHeaderKey);
|
||||||
|
$strHeaderKey = preg_replace("/\-/", "_", $strHeaderKey);
|
||||||
|
|
||||||
|
if (array_key_exists($strHeaderKey, $_SERVER))
|
||||||
|
if (strlen($_SERVER[$strHeaderKey]) > 0)
|
||||||
|
return $_SERVER[$strHeaderKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if all of the arguments are in the POST request
|
// Returns true if all of the arguments are in the POST request
|
||||||
// To be used like:
|
// To be used like:
|
||||||
// if (Request::posts("param1", "param2")) {
|
// if (Request::posts("param1", "param2")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user