GetVars function
Get the input value through GET, POST or COOKIE.
This function encapsulates the HTTP Request method of PHP. Its usage is similar to $_REQUEST, $_GET, $_POST, and $_COOKIE, but it should be noted that is_null
Determine whether the relevant value is obtained.
Similar functions with default values getvarsbydefault 。
grammar
Mixed GetVars ( $name , $type = 'REQUEST' )
Call parameters
Parameter type | parameter | Default | describe |
string | $name | parameter |
string | $type | REQUEST | Type, which is REQUEST by default, and can also be GET, POST or COOKIE |
Return value
When the parameter receives the passed value, it returns the assignment; otherwise, it returns null.
Code example
Example 1
$filename = GetVars ( 'filename' , 'POST' ) ;
if ( is_null ( $filename ) ) {
echo "File name cannot be empty" ;
}