作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
在html中嵌入if else和elseif条件的正确方法是什么?
最佳答案
为了便于阅读,我推荐以下语法。
<? if ($condition): ?>
<p>Content</p>
<? elseif ($other_condition): ?>
<p>Other Content</p>
<? else: ?>
<p>Default Content</p>
<? endif; ?>
注意,在打开的标签上省略 php
确实需要在您的配置中启用 short_open_tags
,which is the default .始终启用相关的无花括号条件语法,并且无论该指令如何都可以使用。
关于php - If else 嵌入到 html 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4731810/
我是一名优秀的程序员,十分优秀!