ThinkPhp query the following content
Game game_zone;
the structure of the table is
zone_name-- Theater name
gid-- Game ID
want to query a returned json in the following format:
"1":
[
{"name": "", "id": "1"},
{"name": "", "id": "2"},
],
"2":
[
{"name": "", "id": "3"},
{"name": "", "id": "4"},
],
wonder how to query? There is no way to use dynamic associative preloading and not thinking about subqueries. The most important thing is: the index of the array is the ID, of the game. Or is the data in this format written manually, not queried and converted to json?
the gods who help solve the problem must be rewarded!