データベースからいくつかのデータを取得し、クライアントに投稿する関数があります。現時点では、データを通常の配列として送信します(出力は MyArray (a、b、c、d ..) のようなものです)が、MyArray (a(b、c、d)) にしたい..のようにカステゴリー(名前、ID、注文...)..誰か助けてください..これは、すでに使用されているバージョンの私のコードです
public function get_button_template()
    {
        $this->q = "SELECT * FROM button_template ORDER BY order_number ASC";
        $this->r = mysql_query($this->q);
        if(mysql_num_rows($this->r) > 0)
        {        
            while($this->f = mysql_fetch_assoc($this->r))
            {
                $this->buttons[$this->i]["ID"] = $this->f["ID"];          
                $this->buttons[$this->i]["name"] = $this->f["button_name"];               
                $this->buttons[$this->i]["category"] = $this->f["button_category"];
                $this->buttons[$this->i]["order_number"] = $this->f["order_number"]; 
                $this->i++;
            }
        }
        return $this->buttons;
    }
編集少し詳細をお願いします..これを解析すると、次のような結果が得られます。
"Vaule"( "Key1": "Value1" "Key2": "Value2" . 
しかし、私が欲しいのは次のようなものです
 `"Category0":( "Key1": "Value1", "Key2": "Value2" . ) 
"Category1":( "Key1": "Value1", "Key2": "Value2" . )..`
キーと値のペアを含む多次元配列を送信するにはどうすればよいですか?