【发布时间】:2017-09-30 20:05:16
【问题描述】:
我正在尝试用文字显示发票中的货币。为什么 $total 值显示为零/零/零?
<td class="no-borders" colspan="2">
<table class="totals">
<tfoot>
<?php foreach( $this->get_woocommerce_totals() as $key => $total ) : ?>
<tr class="<?php echo $key; ?>">
<td class="no-borders"></td>
<th class="description"><?php echo $total['label']; ?></th>
<td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td>
<?php $f = new NumberFormatter("lv", NumberFormatter::SPELLOUT);
echo $f->format($total['value']); ?>
</tr>
<?php endforeach; ?>
【问题讨论】:
-
如果不为零,$total['value'] 的值是多少?
-
您的区域设置代码必须是“lv-LV”,并且必须存在于您的系统中。 php.net/manual/en/class.numberformatter.php
-
@Andreas When i 结果是 20.00 欧元。
标签: php number-formatting