mysql - 如何在mysql/zend框架中存储和处理货币

标签 mysql zend-framework currency

我们希望在 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/

相关文章:

mysql - 在mysql中存储金额

mysql - 如何创建多个 BEFORE INSERT 触发器?

mysql - TravisCI 上 ActiveRecord 到 MySQL 数据库的正确连接字符串是什么?

zend-framework - AjaxContext 和 ContextSwitch 有何不同

php - 从多对多表中返回缺失的结果

java - 如何从以微单位表示的给定金额中提取单位和子单位部分?

c# - 将小数格式化为货币

javascript - xmlhttp 请求后未定义 $_POST

mysql - 移动到 innodb_file_per_table 后如何缩小 ibdata1 文件大小?

mysql - 日期有问题,成员(member)资格已过期但尚未到期