【发布时间】:2014-12-02 10:11:31
【问题描述】:
如果变量不为空,我想回显一些 html,为此我知道我可以执行以下操作:
if (!empty($test)) {
?>
<p>Some nice html can go here</p>
<?php
}
else
{
echo "It's empty...";
}
如何为多个变量执行此操作?因此,如果其中一个变量不为空,则回显 html?这样可以吗?
if (!empty($test || $image || $anothervar)) {
?>
<p>Some nice html can go here</p>
<?php
}
else
{
echo "It's empty...";
}
【问题讨论】:
标签: php if-statement echo