PHP Superglobals
What is PHP Superglobals - described here
Examples
How to get value of $_GET['some_key']
- Query
- Result
query {
some_get_request_parameter: superglobal_variable(variable: "GET", key: "some_key")
}
{
"some_get_request_parameter": "<some_value or null if there is no such key>"
}
How to get value of $_GET['some_key']
with fallback
- Query
- Result
query {
some_get_request_parameter: superglobal_variable(variable: "GET", key: "some_key", fallback: "fallback_value")
}
{
"some_get_request_parameter": "<some_value or fallback value if there is no such key>"
}
How to get value of $_COOKIE['some_key']
- Query
- Result
query {
some_cookie_parameter: superglobal_variable(variable: "COOKIE", key: "some_key")
}
{
"some_cookie_parameter": "<some_value or null if there is no such key>"
}
How to get value of $_COOKIE['some_key']
with fallback
- Query
- Result
query {
some_cookie_parameter: superglobal_variable(variable: "COOKIE", key: "some_key", fallback: "fallback_value")
}
{
"some_cookie_parameter": "<some_value or fallback value if there is no such key>"
}
How to get value of $_SERVER['HTTP_HOST']
- Query
- Result
query {
current_host: superglobal_variable(variable: "SERVER", key: "HTTP_HOST")
}
{
"current_host": "builderius.io"
}