PHP 中为空时隐藏字段

问题描述 投票:0回答:1

不幸的是我对PHP了解不多。这段代码来自一个组件,我只想更改它。如果有可用的话,现在会显示单独的价格,否则显示标准价格 0.00。但现在我希望不显示任何内容,除非单独价格的字段不为空。因此,除了 0.00 之外,应该什么也没有,除非我手动添加一些东西。有人可以帮助我吗?

if ($showPrice) {
$price = $row->price_text ?: EventbookingHelper::formatCurrency($row->individual_price, $config);
?>
<br/>
<div class="kurzinfo"><?php echo $price; ?></div>
<?php
}
php joomla
1个回答
0
投票

请尝试这个价格_文本?:EventbookingHelper::formatCurrency($row->individual_price, $config); if($price != 0.00 || $price != '0.00') { ?>

// 对我来说似乎不错,但是:

如果($价格<= 0){//code} -->也可以这样做吗?

© www.soinside.com 2019 - 2024. All rights reserved.