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

藏色散人
Release: 2021-06-27 09:09:17
forward
2303 people have browsed it

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.

Content

For example:

<if condition=”$id eq  1”>
Copy after login

This is no problem

But if you want to compare two variables:

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

This will cause problems

Solution:

Use the tag:

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

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!

Related labels:
source:segmentfault.com
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