Home  >  Article  >  Backend Development  >  What to do if thinkphp5 ajax reports 500 error

What to do if thinkphp5 ajax reports 500 error

藏色散人
藏色散人Original
2020-07-29 10:17:573081browse

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.

What to do if thinkphp5 ajax reports 500 error

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!

Statement:
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