content"."/> content".">
search
HomePHP FrameworkThinkPHPWhat does eq mean in thinkphp

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor