Please tell me about laravel returning status_code value

WBOY
Release: 2023-03-02 08:36:01
Original
1496 people have browsed it

Because some operators, routers, browsers, etc.;
will intercept non-200 status requests; and then change them to their advertisements or customized pages;

Then the question comes; please tell me,
Where can laravel control all returned status_code values?
The effect I want to achieve is that all ajax requests return 200;

Thank you;

--------------------------Separating line--------------------------
Because there are too many issues involved such as dingo, jwt, etc.;
Temporarily give up the practice of unifying status_code;
When there is a good plan, we will fill in this hole again;

Reply content:

Because some operators, routers, browsers, etc.;
will intercept non-200 status requests; and then change them to their advertisements or customized pages;

Then the question comes; please tell me,
Where can laravel control all returned status_code values?
The effect I want to achieve is that all ajax requests return 200;

Thank you;

--------------------------Separating line--------------------------
Because there are too many issues involved such as dingo, jwt, etc.;
Temporarily give up the practice of unifying status_code;
When there is a good plan, we will fill in this hole again;

Error throwing is controlled by the Symfony/Component/Debug/Exception/FlattenException class in the framework. The file is in
/vendor/symfony/debug/ExceptionFlattenException.php

Modify the create method, there may be other situations where you can try modifying it yourself

<code> if (null === $statusCode) {
            $statusCode = 200;
}
</code>
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!