Home > Backend Development > PHP Problem > php cannot receive data

php cannot receive data

angryTom
Release: 2023-02-27 21:08:02
Original
2441 people have browsed it

php cannot receive data

php cannot receive data

The form form is a very commonly used html tag, which can submit data for us to the server, upload files, etc. Sometimes the background program cannot receive data. Let's take a look at the solution.

1. $_POST cannot receive data, but $_GET can receive data.

1. If the header information content-type is "content-type :application/x-www-form-urlencoded", this transmission is to submit data in the form of a form, and PHP uses the $_POST method to accept it.

2. If the header information content-type is "content-type:application/json", this transmission is to submit data in json mode, and PHP needs to use file_get_contents("php://input" )Accept the way to get the input stream.

2. When uploading files, $_POST data and $_FILES data cannot be received

Cause: The file size exceeds the post_max_size set by php.ini, resulting in POST data is empty, and the FILES data is also empty.

Solution:

1. The simplest is to set the file size post_max_size larger in php.ini and then restart the server.

2. Or use JS on the page to prompt the user, please upload a file of a specified size.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php cannot receive data. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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