我想获得价格价值没有货币符号在产品页为OpenCart。我为此使用了以下代码。但是,这并不完美。如何获得没有货币符号的价格值?
我找到并使用了以下代码。在.tpl文件中。
<?php
$pricenocurrency = $price;
$pricenocurrency = preg_replace('/\D/', '', $pricenocurrency );
echo $pricenocurrency ;
?>
因此,我得到以下结果。但是,我不想从价格中删除点(。)。
默认价格 = 86.02
€我得到 = 8602
我想 = 86.02
可能重复的[RegEx - 如何提取价格?](http://stackoverflow.com/questions/2430696/regex-how-to-extract-price) – Thamilan
@ splash58谢谢。 – HarnishDesign
@HarnishDesign很高兴帮助。祝你好运! – splash58