content"."/> content".">

Home >PHP Framework >ThinkPHP >What does eq mean in thinkphp

What does eq mean in thinkphp

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2022-03-07 10:20:024566browse

In thinkphp, eq is a comparison tag that can compare the values ​​of the tag parameters name and value. If the values ​​​​of name and value are equal, the content between the eq tags will be output. The syntax is "Content".

What does eq mean in thinkphp

The operating environment of this article: Windows 10 system, ThinkPHP version 5, Dell G3 computer.

What does eq mean in thinkphp

The eq tag in thinkphp seems not commonly used, but it is essential

For example, like a certain status, switch Wait, you can't directly read the fields in the database to the customer, and the customer can't understand it, right?

So we can use the eq tag to solve this little problem.

For example: I have a status field in the database, indicating a certain status. I stipulate it: 0 is inactive, 1 is activated

Now I want to display the data of the entire table to Users look, what should I do?

One thing that is certain is that we cannot read 0 and 1 directly. In the front-end template,

looks like this:

{$vo.status}> ;

Let users see it directly. This is not ideal. The customer experience must be poor. . .

Solution:

Use the eq tag to determine the value of status and make a small blind trick:

<eq name="vo.status" value="0">未激活</eq>
<eq name="vo.status" value="1">已激活</eq>

Of course, if it is not a particularly complicated requirement, it can be abbreviated

Like this:

<eq name="vo.status" value="0">未激活<else/>激活</eq>

Note: eq means that if the values ​​​​of name and value are equal, the content between the tags will be output. The name here should not be written as {$vo.status }

Otherwise, no matter how you write it, it will be the value of

Of course, this is just one of the comparison tags in thinkphp. For more information, please refer to the thinkphp manual

 <比较标签 name="变量" value="值">
 内容
 </比较标签>

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What does eq mean in thinkphp. 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