Home  >  Article  >  Backend Development  >  Things to note when using PHP4.2.0 and later versions_PHP Tutorial

Things to note when using PHP4.2.0 and later versions_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:22:53748browse

Starting from PHP version 4.2.0, the default value of the PHP directive register_globals is off (in the php.ini configuration file). This is a major change in PHP. What is register_globals used for? It is used by PHP to control whether to register EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables. For example, for the var here in http://www.xx.php?var=2, when it is on, you only need to use $var, but when it is off, you must use $_GET["var"] Received~ The $_GET here is an array of PHP super global variables. Likewise: $GLOBALS contains a reference to a variable that is globally valid for each current script. The keys of this array are labeled with the names of global variables. The $GLOBALS array exists since PHP 3. The $_SERVER variable is set by the web server or is directly associated with the execution environment of the current script. Equivalent to the old array $HTTP_SERVER_VARS array, but not a variable like $_SERVER because PHP handles them differently, the same below. Although $HTTP_SERVER_VARST and the $HTTP_*_VARS below can still be used, it is never recommended that you use $HTTP_*_VARS. $_GET Variables submitted to the script via the HTTP GET method. For example, variables generated by the GET method of URL and form. Usage: $_GET["xx"]; //That is, $xx; the same below. $_POST is a variable submitted to the script via the HTTP POST method. For example, variables generated by the form's POST method. Usage: $_POST["xx"]; $_COOKIE Variables submitted to the script via the HTTP Cookies method. For example, when reading the COOKIE value. $_FILES Variables submitted to the script via HTTP POST file upload. My other article asp$id=22950&page=1 target=_blank> further explains the file upload processing process. Its usage has been introduced in more detail and will not be explained here. $_ENV Variables submitted to the script by the execution environment. $_REQUEST is a variable submitted to the script through any user input mechanism, including GET, POST, COOKIE, etc., so this array is not trustworthy. $_SESSION is an array storing SESSION variables. You don't need to use session_regisger to register a variable. Use $_SESSION["xx"] to include the above process. Please do not follow this post again. If you have any questions, open a new topic[br]Thank you for your cooperation

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532257.htmlTechArticleStarting from PHP 4.2.0 version, the default value of the PHP directive register_globals is off (in the php.ini configuration file ). This is a major change in PHP. What is register_globals used for? ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn