Php Joomla:在REST-get方法中传递项数组

Php Joomla:在REST-get方法中传递项数组,php,joomla3.0,restful-url,Php,Joomla3.0,Restful Url,我正在为移动应用程序编写一个RESTFul服务。我的REST url如下: /index.php/jbackend/get/recipe/list_recipe?id=3,4,5 式中,3、4、5为受方 在joomla代码中,我需要解析以下内容: $ids = $app->input->get('id', array(), 'ARRAY'); $i=0; foreach($ids as $id){ $i+=1; $respon

我正在为移动应用程序编写一个RESTFul服务。我的REST url如下:

/index.php/jbackend/get/recipe/list_recipe?id=3,4,5
式中,3、4、5为受方

在joomla代码中,我需要解析以下内容:

    $ids = $app->input->get('id', array(), 'ARRAY');
    $i=0;
    foreach($ids as $id){
        $i+=1;
        $response['array'.$i] = $id;
    }
我得到的答复是

{"array1":"4,5,6"}
我希望是

{"status":"ok","array1":"4","array2":"5","array3":"6"}

要获得上述信息,需要更改哪些内容?

我找到了一种方法,如下所示:

将参数传递为

  • 得到

    /index.php/jbackend/get/recipe/list_recipe?id[]=3&id[]=4&id[]=5

  • 职位

    /index.php/jbackend/get/recipe/list\u recipe 参数作为后置参数

  • 希望这对其他人有帮助