所以我试图在PHP中做一个if/else语句,我有if语句,它返回我想要的,但我似乎无法弄清楚else语句。有没有人有任何想法?试图写一个PHP的if/else语句,但失败悲惨谁能帮我吗?
<div class="row">
<?php while($items->have_posts()) : $items->the_post(); ?>
<?php
if(get_field('sauce_or_spice')): ?>
<div class="large-4 medium-6 columns">
<h5><?php the_title(); ?></h5>
<a href="https://shop.deadeyebbq.com/password" ?>
<div class="thumbnail products">
<?php the_post_thumbnail('thumbnail'); ?>
</div>
</a>
<p><?php the_field('description'); ?></p>
<p><?php the_field('price'); ?></p>
<a class="video-button">Buy now!</a>
</div>
<?php elseif(get_field(!('sauce_or_spice'))): ?>
<?php echo'HELLO'; ?>
<?php endif; ?>
<?php endwhile;?>
</div>
什么你** **要在'else'语句返回多少? [**最小,完整和可验证的示例**](http://stackoverflow.com/help/mcve)的一部分描述了**应该发生的事情 - 简单地说明有些事情不起作用提供问题陈述。 –
@ObsidianAge我想让它给我一个地方来回报一些东西,我要做一个单独的div。如果我可以回应一些东西,看看它是否正常工作,那就是我所需要的。 – Branduo
如果你写了'!('sauce_or_spice')'......什么不是(!)字符串?你想要的是'!get_field('sauce_or_spice')' –