国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP $_POST variable

PHP $_POST variable

In PHP, the predefined $_POST variable is used to collect values ??from the form with method="post".

$_POST variable

The predefined $_POST variable is used to collect forms from method="post" value in .

Information sent from a form with the POST method is invisible to anyone (will not be displayed in the browser's address bar), and there is no limit on the amount of information sent.

Note: However, by default, the maximum amount of information sent by the POST method is 8 MB (can be changed by setting post_max_size in the php.ini file).

Example

form.html file code is as follows:

<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
 
<form action="welcome.php" method="post">
名字: <input type="text" name="fname">
年齡: <input type="text" name="age">
<input type="submit" value="提交">
</form>
 
</body>
</html>

When the user clicks the "Submit" button, the URL is similar to the following:

form1.gif

When to use method="post"?

Information sent from a form with the POST method is invisible to anyone, and there is no limit on the amount of information sent.

However, since the variable does not appear in the URL, the page cannot be bookmarked.

PHP $_REQUEST variable

The predefined $_REQUEST variable contains the contents of $_GET, $_POST and $_COOKIE.

$_REQUEST variable can be used to collect form data sent via GET and POST methods.

Example

You can modify the "welcome.php" file to the following code, which can accept $_GET, $_POST and other data.

Welcome<?php echo $_REQUEST["fname"]; ?>!<br>

Your age is<?php echo $_REQUEST["age"] ; ?> Years old.

The difference between GET and POST value transfer methods:

1. Get adds the data in the form to the form in the form of variable=value. Behind the URL pointed to by the action, and the two are connected using "?", and each variable is connected using "&"; Post puts the data in the form in the data body of the form, according to the corresponding way of variables and values. , passed to the URL pointed to by the action.

2, Get is unsafe because during the transmission process, the data is placed in the requested URL, and many existing servers, proxy servers or user agents will record the request URL in log files. , and then put it somewhere so that some private information may be seen by a third party. In addition, users can also see the submitted data directly on the browser, and some internal system messages will be displayed in front of the user. All Post operations are invisible to users.

3. The amount of data transferred by Get is small, mainly because it is limited by the URL length; while Post can transfer a large amount of data, so only Post can be used to upload files (of course there is another reason, which will be discussed later) mentioned).

4, Get restricts the value of the data set in the Form form to be ASCII characters; while Post supports the entire ISO10646 character set.

5, Get is the default method of Form.

Continuing Learning
||
PHP $_POST 變量 ________________________________________ 在 PHP 中,預(yù)定義的 $_POST 變量用于收集來自 method="post" 的表單中的值。 ________________________________________ $_POST 變量 預(yù)定義的 $_POST 變量用于收集來自 method="post" 的表單中的值。 從帶有 POST 方法的表單發(fā)送的信息,對任何人都是不可見的(不會顯示在瀏覽器的地址欄),并且對發(fā)送信息的量也沒有限制。 注釋:然而,默認情況下,POST 方法的發(fā)送信息的量最大值為 8 MB(可通過設(shè)置 php.ini 文件中的 post_max_size 進行更改)。 實例 form.html 文件代碼如下: <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form action="welcome.php" method="post"> 名字: <input type="text" name="fname"> 年齡: <input type="text" name="age"> <input type="submit" value="提交"> </form> </body> </html> 當用戶點擊 "提交" 按鈕時,URL 類似如下所示: http://m.miracleart.cn/welcome.php "welcome.php" 文件現(xiàn)在可以通過 $_POST 變量來收集表單數(shù)據(jù)了(請注意,表單域的名稱會自動成為 $_POST 數(shù)組中的鍵): 歡迎 <?php echo $_POST["fname"]; ?>!<br> 你的年齡是 <?php echo $_POST["age"]; ?> 歲。 ________________________________________ 何時使用 method="post"? 從帶有 POST 方法的表單發(fā)送的信息,對任何人都是不可見的,并且對發(fā)送信息的量也沒有限制。 然而,由于變量不顯示在 URL 中,所以無法把頁面加入書簽。 ________________________________________ PHP $_REQUEST 變量 預(yù)定義的 $_REQUEST 變量包含了 $_GET、$_POST 和 $_COOKIE 的內(nèi)容。 $_REQUEST 變量可用來收集通過 GET 和 POST 方法發(fā)送的表單數(shù)據(jù)。 實例 你可以將 "welcome.php" 文件修改為如下代碼,它可以接受 $_GET、$_POST等數(shù)據(jù)。 歡迎 <?php echo $_REQUEST["fname"]; ?>!<br> 你的年齡是 <?php echo $_REQUEST["age"]; ?> 歲。 GET和POST傳值方式的區(qū)別: 1,Get將表單中數(shù)據(jù)的按照variable=value的形式,添加到action所指向的URL后面,并且兩者使用“?”連接,而各個變量之間使用“&”連接;Post是將表單中的數(shù)據(jù)放在form的數(shù)據(jù)體中,按照變量和值相對應(yīng)的方式,傳遞到action所指向URL。 2,Get是不安全的,因為在傳輸過程,數(shù)據(jù)被放在請求的URL中,而如今現(xiàn)有的很多服務(wù)器、代理服務(wù)器或者用戶代理都會將請求URL記錄到日志文件中,然后放在某個地方,這樣就可能會有一些隱私的信息被第三方看到。另外,用戶也可以在瀏覽器上直接看到提交的數(shù)據(jù),一些系統(tǒng)內(nèi)部消息將會一同顯示在用戶面前。Post的所有操作對用戶來說都是不可見的。 3,Get傳輸?shù)臄?shù)據(jù)量小,這主要是因為受URL長度限制;而Post可以傳輸大量的數(shù)據(jù),所以在上傳文件只能使用Post(當然還有一個原因,將在后面的提到)。 4,Get限制Form表單的數(shù)據(jù)集的值必須為ASCII字符;而Post支持整個ISO10646字符集。 5,Get是Form的默認方法。
submitReset Code