我想呼應的一些HTML,如果一個變量不是empy,爲了這個,我知道我能做到以下幾點:顯示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...";
}
事實上,OP的代碼將_唯一的one_參數傳遞給'empty'。 – mudasobwa 2014-12-02 10:15:13