Thinkphp5.0 cannot receive the data sent by the post request?

A simple post request, which was normal before, suddenly went wrong. As thinkphp5.0 is not very familiar with it, it should not be a big problem. I hope you will pass by and have a look.

  1. WeChat Mini Programs client sends post request code, which does not involve WeChat Mini Programs"s knowledge

clipboard.png

postman

clipboard.png

Route::post("api/:version/token/user","api/:version.Token/getToken");

clipboard.png

clipboard.png
from the point of view of the Request object, there is no problem. The way is that the post, data is also in this object. What is puzzling is that it was all good before, and the value of code was obtained directly by parameter binding. Now I don"t know where I changed it, or how I suddenly made a mistake.
Thank you all for passing by for your advice. If you have any mental retardation, please include it.

Mar.17,2021

in postman, if Content-Type is application/x-www-form-urlencoded, Body and from-data is, it will be received in $_ POST
Content-Type is application/json, Body and file_get_contents ("php://input") is used to receive

for raw (JSON).

that's why it's in input.


received data not received? Either all () or input () can be used to receive Post data. It is best to print in front of the receiving method to see if there is any post data. If not, it is the problem where you pass parameters


what is this tool with breakpoint debugging function?


try to change the routing side to Route::any ().


how to configure xdebug breakpoint debugging for phpstorm


you can take a look at this blog post which may be helpful to you. Address: https://www.blanc.site/archiv.

Menu