【发布时间】:2011-11-24 16:08:26
【问题描述】:
我想用 PHP 构建一个 json 对象。 json 对象需要是这样的(用于创建谷歌折线图):
{"cols":[{"id":"bingo","label":"bingo","type":"string"},{"id":"value","label":"value","type":"number"}],"rows":[{"c":[{"v":"date1"},{"v":151}]},{"c":[{"v":"date2"},{"v":102}]},{"c":[{"v":"date3"},{"v":52}]},{"c":[{"v":"date4"},{"v":32}]},{"c":[{"v":"date5"},{"v":7}]},{"c":[{"v":"date5"},{"v":7}]},{"c":[{"v":"date5"},{"v":7}]}]}
我在创建以下部分时遇到问题:
{"c":[{"v":"date3"},{"v":52}]},{"c":[{"v":"date4"},{"v":32}]},{"c":[{"v":"date5"},{"v":7}]},{"c":[{"v":"date5"},{"v":7}]},{"c":[{"v":"date5"},{"v":7}]}
如何使用 PHP 创建它?
【问题讨论】:
-
创建它时遇到什么问题?您的原始数据是什么样的?