HTTP, Server, and Session helper class of PHP.
This classes are made for pure-PHP codes not using framework.
Using pure PHP, it's bother to get params value like $_GET, $_POST, $_SESSION...etc.
if(isset($_GET["val"])){
$val = $_GET["val"];
}
else{
$val = null;
}Here're easy ways to get values using class methods.
// Example url: http://aaa.bbb.com/?val=1
$val = Http::get("val"); // => string("1")
$val2 = Http::get("val2"); // => null
// You can specify default values at second argument.
// Example url: http://aaa.bbb.com/
$val = Http::get("val", "No value"); // => string("No value")
// If you wish to cast value,set type name to 3rd argument. ※Default cast value is "String"
// Example url: http://aaa.bbb.com/?val=111
$val = Http::get("val", 0, "int"); // => int(111)
// If cast failed, method returns default value.
// Example url: http://aaa.bbb.com/?val=abc
$val = Http::get("val", 0, "int"); // => int(0)You can use these name to 3rd argument.
- str
- string
- int
- integer
- bool
- boolean
- array
- object
- unset
Returns request method name.(Example: "GET", "POST", "PUT"...)
=============
Returns $_GET value.
=============
Returns $_POST value.
=============
Returns $_REQUEST value.
=============
Returns $_COOKIE value.
=============
Returns $_SESSION value.
=============
Returns $_SERVER value.