简体   繁体   English

使用php echo显示图像时,Firefox和Explorer的行为有所不同

[英]Firefox and Explorer behaving differently when displaying image with php echo

The image box on this page " http://www.ebookfetcher.com/bookdeals/index.php?pid=23 " appears in Firefox and Explorer, but not Chrome and Safari. 此页面上的图像框“ http://www.ebookfetcher.com/bookdeals/index.php?pid=23 ”出现在Firefox和Explorer中,但没有出现在Chrome和Safari中。 How do I make it invisible for all of them when $bookpage_coverimage is empty? 当$ bookpage_coverimage为空时,如何使它们对所有人不可见?

<a href="http://www.ebookfetcher.com" class="linkstyle"><img src="<?php echo $bookpage_coverimage ?>" width="260"></a>

With a simple if statement in PHP. 用PHP中的简单if语句。

<?php if($bookpage_coverimage !=""){ ?><a href="http://www.ebookfetcher.com" class="linkstyle"><img src="<?php echo $bookpage_coverimage ?>" width="260"></a><?php } ?>

Should do the trick, it will not output any html if its empty. 应该可以解决这个问题,如果它为空,它将不会输出任何html。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM