content"."/> content".">

Home >PHP Framework >ThinkPHP >Comparison of variables between if tags and comparison tags in ThinkPHP

Comparison of variables between if tags and comparison tags in ThinkPHP

藏色散人
藏色散人forward
2021-06-26 14:52:152341browse

Comparison of variables between if tags and comparison tags in ThinkPHP

In ThinkPHP, if tags and comparison tags compare variables.

In TP template language. Both if and eq can be used to compare variables.

2eba34dcf6b1315fa8eb61e83afb62e5Content06bf94b0c2e62ce6dc5e04966c6e0770

For example:

<if condition=”$id eq  1”>

This is no problem

But if you want to compare two variables:

<if condition=”$a.id eq $b_id”>

This will cause problems

Solution:

Use the 51faf65e8b6068cf8f1bce82b64f00c3 tag:

<eq name=”a.id” value=”$b.id”>

Note: There is no need to add the $ variable symbol to the name, but the $ variable symbol is required to the value.

"Related recommendations: The latest 10 thinkphp video tutorials"

The above is the detailed content of Comparison of variables between if tags and comparison tags in ThinkPHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete