开发者

Passing an array as a query string parameter for an API

I have some API instructions I am trying to follow

(string) source (string) key (string) params[file] (string) params[gender] (int) params[age]

I get how to make the API calls but where it has a开发者_JAVA技巧n array for params (file, gender and age) how to I put that into a query string?

The call works with something like this:

GET https://api-url.com/api?source=lorem&key=dolor

But how would I append that with the params? params[file]=file_name.gif ??

That doesn't seem to work but I'm open to the fact something else could be wrong - just wanted to check how you pass an array in a query string?

Thanks


Yes it's params[file]=xy in the query string:

your-url/api?source=lorem&key=dolor&params[file]=file_name.gif&params[age]=23..

Access in PHP: $yourfile = $_GET['params']['file'];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜