Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 div 之前检查变量值,以便如果变量为空,则隐藏处于 if 条件的 div,反之亦然。
例如:
<?php $var=has_post_thumbnail(); if(!empty($var)){ ?> <div>//some code that is shown only if var has some value</div> <?php } ?>
<?php if(isset($var)) // or check for empty if you want that way{ ?> <div> yes variable is set </div> <?php } else { ?> <div> variable not set division </div> <?php } ?>