【发布时间】:2017-04-18 14:55:51
【问题描述】:
json_encode 将对象转换为:
{
"height":10,
"width":20,
"depth":5
}
但我还需要它包含对象类名:
{
"cuboid":
{
"height":10,
"width":20,
"depth":5
}
}
【问题讨论】:
-
使用
json_encode(array('cuboid' => array( "height" => 10, "width"=>20, "depth"=>5) )) -
你的代码栈是什么?