When I saved the special product list today, I found that there were more than 2,300 pieces of data on the front end, but the actual server only accepted 166 pieces of data and stored them in the database
After debugging, it was found that the amount of data was correct when the front-end page submitted the post request, but only 166 items could be received from the server.
At first I thought the post request length exceeded the limit, but after looking at the request content, it was only over 200K, and the post request default supports data transmission within 8M.
So I suspected that it might be caused by the internal configuration of PHP. Later, Baidu searched and found the configuration item max_input_vars. This configuration item was added after PHP 5.3.9 version to prevent hash conflicts.
In this case, change the configuration item, The default is 1000, change it to 10000; after restarting the service, it is found that the amount of data obtained by the server is 1666, which is 10 times the previous one, which is exactly what happened after the configuration item was adjusted. multiple.
However, the amount of data transmitted by the front end is uncertain. Even if max_input_vars is set to 100,000, it may not be enough, so we should find another way.
1. The front end converts the array into json for transmission, that is, JSON.stringify(goodsList)
2. The server receives and parses $goodsList = json_decode($_POST['goodsList'], true);
3. The test found that the data sent from the front end can be obtained by the server, and the problem was successfully solved