0

我想在这段代码中将 include_players_ids[] 值替换为多个玩家 id 的数组。我试过身体,但它说不推荐使用。请提供任何帮助。Guzzle 版本是 6。我尝试了 ['id', 'id'] 和 array('id', 'id')。响应是“include_player_ids”应该是一个数组或格式错误

$client = new Client();
    try {

        $r = $client->request('POST', 'https://onesignal.com/api/v1/notifications', [

            'form_params' =>
                [

                'app_id' => 'app_id',

                'include_player_ids[]' => '9cc7691d-04ea-4245-9eed-667f70a218c1',

                'headings' => [
                    'en' => $request->input('title')
                ]
            ]
        ]);
4

1 回答 1

1

你可以试试:

'form_params' =>
                [

                'app_id' => 'app_id',

                'include_player_ids' => ['9cc7691d-04ea-4245-9eed-667f70a218c1', 'dummy']

                'headings' => [
                    'en' => $request->input('title')
                ]
            ]

http://docs.guzzlephp.org/en/stable/request-options.html#form-params

于 2020-01-16T04:39:59.780 回答