Z-Blog Wiki Z-Blog Wiki

Official Z-Blog Library

User Tools

Site Tools


zblogphp:development:functions:getvars

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" ;
 }

zblogphp/development/functions/getvars.txt ·Last change: 2016/06/21 16:52 (external editing)