Home >Backend Development >PHP Problem >One minute to figure out what are predefined variables in php? What is the $_POST variable?

One minute to figure out what are predefined variables in php? What is the $_POST variable?

慕斯
慕斯Original
2021-06-30 15:42:442780browse

We have learned so much about PHP. Today we will learn in one minute what are predefined variables in PHP? What is the $_POST variable? , I wonder if you have fully mastered it. If not, then follow this article to continue learning

Related recommendations:What are variable variables in PHP? How to understand mutable variables?

Predefined variables:

The so-called predefined variables actually refer to variables that are predefined in the language tool PHP;

We just "enjoy it and use it"

Overview:

Mainly include:$, _GET,S_ POST,$_ REQUEST, $ _ SERVER, $GLOBALS,

  • ## are all arrays

  • system definition and maintenance - that is, we should not assign values ​​​​to them or To destroy its value, you should only "use its value"

  • has a super-global scope and can be used anywhere.

  • May have different values ​​in different situations

$_POST variable:

Meaning:

It represents all the data submitted when the user submits through the form in post mode (methodu "post") - this is called post data.

<!--
以下表单的数据,点击提交后,会将所有表单数据提交给
8post_ _data.php这个页面(文件),并在该文件中去处理
其实就是指:程序进入该文件中运行。
=-》
<form action="8post data. php" method="post">
数据1: <input type="text" name="data1 />
<br />
数据2: <input type="text" name= "data2" />
<br />
<input type="submit" value="提交" />
</form>

The code is as follows:

$post_data php page and output results:

<?php
//先一个一个获取数据:
$d1 = $_POST[&#39;datal&#39;];
$d2 = $POST[ &#39;data2&#39;];
//然后输出,看看:
echo "d1 = $d1, d2 = $d2";
echo "<hr />";
//再来看看整个$_ POST这个数组数据!
print_r($_POST);
?>

The running results are as follows:

One minute to figure out what are predefined variables in php? What is the $_POST variable?

ise (variable):

Determine whether the variable exists or whether the variable is empty (nul); if it exists, it is true, otherwise It is false

empty (variable): Determine whether the "inner core" of the variable is empty (not null, but empty). Basically, it is some rigid rules. The following data are all "empty" ": ."" "0", false, null, array0The empty array is also empty

If the content of a variable is empty, the result returned by empty(0 is true, otherwise it is false;

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of One minute to figure out what are predefined variables in php? What is the $_POST variable?. For more information, please follow other related articles on the PHP Chinese website!

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