Home  >  Article  >  Backend Development  >  Please tell me about laravel returning status_code value

Please tell me about laravel returning status_code value

WBOY
WBOYOriginal
2016-12-01 00:57:021525browse

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>
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
Previous article:php date problemNext article:php date problem