Home >PHP Framework >ThinkPHP >How to determine whether it is an ajax request in thinkphp5

How to determine whether it is an ajax request in thinkphp5

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-26 11:48:474426browse

How to determine whether it is an ajax request in thinkphp5

Open the thinkphp5 project file.

How to determine whether it is an ajax request in thinkphp5

Add comments to this program.

How to determine whether it is an ajax request in thinkphp5

Related recommendations: "ThinkPHP Tutorial"

Create a new method isajax.

How to determine whether it is an ajax request in thinkphp5

Introduce the request object.

How to determine whether it is an ajax request in thinkphp5

Determine whether an ajax request is made through the isAax method.

How to determine whether it is an ajax request in thinkphp5

Print the judgment result.

How to determine whether it is an ajax request in thinkphp5

Create a post request and click submit. The result shows false, indicating that it is not an ajax request.

How to determine whether it is an ajax request in thinkphp5

How to determine whether it is an ajax request in thinkphp5

The above is the detailed content of How to determine whether it is an ajax request in thinkphp5. 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