我们希望在 MySQL 中存储产品价格和重量(公斤/磅)。有人可以告诉我最好的方法是什么吗?
double /十进制/...?
我们需要能够显示美元和欧元。 我不知道这是否有帮助,但我们使用 Zend 框架来构建我们的应用程序。
最佳答案
你看过Zend_Currency吗?函数族?
This component works with all available locales and therefore knows about more than 100 different localized currencies. This includes informations like currency names, abbreviations, money signs and much more.
Zend_Currency has the advantage that already defined currency representations can be reused. You could also have 2 different representations for the same currency.
Zend_Currency allows you also to calculate with currency values. Therefore, it provides you an interface to exchange services.
如果您喜欢 Zend Framework 的这一部分,我想很多决策都会根据它们用来处理值的内容“自行解决”。
关于mysql - 如何在mysql/zend框架中存储和处理货币,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2511567/