Form-phppost: submit data $ _ POST is empty. file_get_content (php: // input) can be obtained. Why?

Source: Internet
Author: User
Phppost: submit data $ _ POST is empty. file_get_content (php: input) can be obtained. Why? The Code submitted by using the form installed with MAMP in the environment is as follows: {code...} doLogin. php code: {code...} the result of capturing packets with a vase:

Php post submit data $ _ POST is empty file_get_content (php: // input) can be obtained. Why?
The environment is installed with MAMP
The Code submitted by form is as follows:

The doLogin. php code is as follows:

include_once '../include.php';$username = $_POST['username'];$password = md5($_POST['password']);$verify = $_POST['verify'];$session_verify = $_SESSION['verify'];var_dump($_POST);var_dump($_SERVER);

Result of capturing packets with vase:

Reply content:

Php post submit data $ _ POST is empty file_get_content (php: // input) can be obtained. Why?
The environment is installed with MAMP
The Code submitted by form is as follows:

The doLogin. php code is as follows:

include_once '../include.php';$username = $_POST['username'];$password = md5($_POST['password']);$verify = $_POST['verify'];$session_verify = $_SESSION['verify'];var_dump($_POST);var_dump($_SERVER);

Result of capturing packets with vase:

Firstphp://inputYesphp.iniYou can directly obtain the original post data.

While$_POSTIt is subject to the limitation of the header. The English Manual (the Chinese manual does not contain this section, it is omitted) has the following introduction:

An associative array of variables passed to the current script via the http post method when using application/x-www-form-urlencoded or multipart/form-data as the HTTP Content-Type in request.

That's yours.Content-TypeOnly yesapplication/x-www-form-urlencodedOrmultipart/form-dataThe predefined variable $ _ POST will be included.

Another scenario can be used.$HTTP_RAW_POST_DATA.php://inputThe obtained data is the same, but this variable isphp.iniOptions inalways_populate_raw_post_data.

Form action = "doLogin. php" Here, write the action address to the full path.

Action = "./doLogin. php"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.