This article brings the content is about PHP commonly used magic constants and super-global variables, a simple summary, there is a certain reference value, there is a need for friends to refer to, I hope you have some help.
First, Common Magic constants
Gets the directory where the current file resides, such as: D:\webecho __dir__;//gets the absolute path of the current file, directory + file name, such as: D:\web\index.phpecho __file__;//the class name of the currently running script Echo __class_ _;//the name of the function that is currently running the script echo __function__;//the method name of the currently running script echo __method__;/* Note: In a non-class method body, __function__ is equivalent to __method__; class method Body __ METHOD__ will contain the class name, such as: classname::methodname*/
Second, the common super-global variables
$_cookie An array of variables passed to the script by HTTP, recorded on the client Print_r ($_cookie); $_cookie[' var_name '] = ' COOKIE '; Assignment echo $_cookie[' Var_name ']; The value//$_session is stored on the server side of the variable array, need to rely on $_cookiesession_start ();//open SESSION, need to write at the beginning of the file Print_r ($_session); $_session[' Var_ Name '] = ' session '; Assignment echo $_session[' Var_name ']; Value//$_get get URL carry parameters echo $_get[' param '];//$_post get http using POST method to pass the parameters echo $_post[' param '];