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

What to do if thinkphp5 ajax reports 500 error

藏色散人
Release: 2023-03-03 13:12:01
Original
3120 people have browsed it

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!

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