How can you judge whether a number or its calculation result can be a divisor in the Anqi CMS template?
divisibleby
The filter can determine whether a number or its calculation result can be used as a dividend.The filter will return a boolean value (bool), True indicates it is allowed, False indicates it is not allowed.
Usage Instructions
divisibleby
How to use the filter:
{{ number|divisibleby:取模值 }}
For example, the following judgment21
Use3
Whether the modulus can be used as the dividend, it can be written like this:
{{ 22|divisibleby:"3" }}
# 显示结果
False
Here is an example demonstration
{{ 21|divisibleby:3 }}
{{ 21|divisibleby:"3" }}
{{ 21|float|divisibleby:"3" }}
{{ 22|divisibleby:"3" }}
{{ 85|divisibleby:42 }}
{{ 84|divisibleby:42 }}
# 显示结果
True
True
True
False
False
True