search
Homephp教程php手册解析Thinkphp 中的<if><volist>等标签为什么不能用

if标签在HTML中用不了,根本没进行判断

tp 里的使用方法为

可以查看自己的模板引擎使用的是什么?

如果你使用的是Smarty引擎,那么if volist 等tp 内置的一些标签是不能用的。

解决办法:

1;把模板引擎修改为默认的tp 引擎;

2:使用Smarty 内置的一些标签,{if} 等使用方法,可以参考Smarty使用手册,解决。smarty内建函数if、elseif与else的使用方法,分享给大家供大家参考。

<html>
<h2>smarty内建函数if、elseif和else的使用</h2>
<p style="color:red">实例1——>if的使用:取出键名不等于c3和n3之外的键值</p>
{foreach from=$arr4 item=temp}
 {foreach from=$temp item=value key=k}
  {if $k neq "c3" and $k neq "n3"}
   {$k}={$value}
  {/if}
 {/foreach}<br />
{/foreach}
<p style="color:red">实例2——>elseif的使用:如果是美女,输出一句,否则输出另外一句</p>
{foreach from=$arr4 item=temp}
 {foreach from=$temp item=value key=k}
  {if $value eq "美女"}
   你是个美女
  {else}
   你们都是帅哥
  {/if}
 {/foreach}
{/foreach}
</html>
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

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.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

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.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use