PHP - 如果变量不为空,则回显一些 html 代码
如果变量不为空,我想显示一些html代码,否则我不想显示任何内容。
我尝试过这个代码,但不起作用:
<?php
$web = the_field('website');
if (isset($web)) {
?>
<span class="field-label">Website: </span><a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a>
<?php
} else {
echo "Niente";
}
?>