php Ajax500 error solution: first open the error script file; then modify the error code to "echo json_encode($arr)"; finally save the modified file.
Recommendation: "PHP Tutorial"
Scenario: Several sites from Alibaba Cloud Migrate to Tencent Cloud, and then TP5 project ajax request reports 500 error. The data is returned successfully, but the http status code is 500. If you don’t go to success, you keep going to error
## as shown below:
## Reason analysis:
The server centos version is different, but according to experience, it should not be caused by it. The tracking code is not caused by different versions,Just throw the method:
## As shown above: Do not use exit() method, do not use json(), Use echo json_encode($arr)
That’s it
The above is the detailed content of What to do if thinkphp5 ajax reports 500 error. For more information, please follow other related articles on the PHP Chinese website!