第一步,先去数据库查询类别数据,然后交给生成json数据的函数处理,代码如下: /*生成类别JSON数据*/ public function wirteJson(){ $dataInfo = \think\Db::query("select id as v,name as n,pid from think_pro_category"); $data = $this->getCategoryJson($dataInfo); return $data; } 第二步,将查询出来的类别数
//build an info object and convert to json NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys: [loan objectForKey:@"name"], @"who", [(NSDictionary*)[loan objectForKey:@"location"] objectForKey:@"country"