Symfony
让我感受到了 YAML 的力量。我曾经默认使用 MySQL 为电子商务网站制作表格,例如 supported_countries
、 units_of_measure
或 sku_conditions
。但是现在,我可能更喜欢使用 YAML
来创建 config/countries.yml
、 config/units.yml
或 config/skuConditions.yml
。所以我很好奇——在这样的情况下,在决定 解析和分析 YAML 文件时是否有重要的性能因素需要考虑 ~ vs ~ 查询和分析 SQL 数据?
国家.yml
US:
code: US
name: United States
CA:
code: CA
name: Canada
skuConditions.yml
default-unit: new
units
new:
short: new
long: brand spanking new
description: never been used.
open-box:
short: open
long: pretty much new
description: the box has been opened but never used.
最佳答案
我认为 YAML 非常适合用于配置文件,Symfony 就是这样使用它的,但是如果您的数据变化很大,则需要一个数据库。如果您担心性能,请考虑使用像 MongoDB 这样的 NoSQL 数据库。
关于php - 使用 YAML 替换较小的 SQL 表?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13690894/