目前获取到的结果是 如示例1 结构 ,
表中没有value字段
$tree = M('Kind')->where(array('status'=>1))->field('id, title as name')->select();
$this->ajaxReturn($tree);
想要获取 如示例2 的结构,有方便的方法吗?
框架是 thinkphp
//示例1
[
{"id": "4","name": "服饰鞋类箱包"},
{"id": "8","name": "母婴"}
]
//示例2
[
{"value":{"id":4,"name":"服饰鞋类箱包" }},
{"value":{ "id":8,"name":"母婴"}}
]
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
小伙看你根骨奇佳,潜力无限,来学PHP伐。