我正在尝试以以下格式发出 API 请求:
/api/v1/courses?enrollment_state=active&include[]=total_students&include[]=term
如何使用HttpClient
组件查询字符串参数执行此操作?
$response = $client->request('GET', '/api/v1/courses', [
'query' => [
'enrollment_state' => 'active',
'include[]' => 'term',
'include[]' => 'total_students',
],
]);
由于重复的数组键,上述方法不起作用?
我也试过:
'include[]' => ['term', 'total_students']