Home > Backend Development > PHP Tutorial > Explain the predefined super global array variables of PHP arrays

Explain the predefined super global array variables of PHP arrays

jacklove
Release: 2023-03-30 17:30:02
Original
1263 people have browsed it

php Arrays play an important role in php. This article will explain its related contents in detail.

1)GLOBALS

2) _SERVER

Server variables, different web servers may have different contents

3) G ET gets HTTPGET Parameters passed by the HTTP POST method, such as parameters passed by the url or form GET method

4) _POST

Get parameters passed by the HTTP POST method, such as parameters passed by the form POST method

5) F ILESHTTP file upload variable

6) _COOKIE

7) S ESSION

8) _REQUEST

includes G ET, _POST and C OOKIE All content in .

9) _ENV

Environment variables are related to the environment in which PHP is running.

If there is no data, it may be related to the phpini configuration item variables_order configuration item

already A defined (existing) variable (the type of data stored is an array).

Super global: super global variable, scope (valid area)!

There are two main ways to pass data (submit data) to the server

1.get method

For example:

Parameter name=parameter value¶meter Name = parameter value...

On the server side (the requested php file), you can obtain the _GET index value as the parameter name through GET, and the data corresponding to the index value is the parameter value

2.Post method

For example, it is sent via form post!

Can be obtained through $_POST!

<?php
var_dump($_GET);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>预定义超全局数据变量</title>
</head>
<body>
<form method="get">
    姓名:<input type="text" name=&#39;username&#39; /><br />
    性别:<input type="text" name=&#39;sex&#39; /><br />
    <input type="text" name=&#39;dwqdwqdqw&#39; />
    <input type="submit" value=&#39;提交&#39; />
</form>
</body>
</html>
Copy after login

This article explains the predefined super-global array variables of PHP arrays. For more related content, please pay attention to the PHP Chinese website.

Related recommendations:

Explain how to use pdo placeholder in php

##List PHP null value detection functions and methods

PHP connects to the database and implements the most basic add, delete, modify and query operations through process-oriented methods

The above is the detailed content of Explain the predefined super global array variables of PHP arrays. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template