How to pass an array within a query string?

前端 未结 10 1336
一整个雨季
一整个雨季 2020-11-22 02:35

Is there a standard way of passing an array through a query string?

To be clear, I have a query string with multiple values, one of which would be an array value.

10条回答
  •  旧巷少年郎
    2020-11-22 02:50

    A query string carries textual data so there is no option but to explode the array, encode it correctly and pass it in a representational format of your choice:

    p1=value1&pN=valueN...
    data=[value1,...,valueN]
    data={p1:value1,...,pN:valueN}

    and then decode it in your server side code.

提交回复
热议问题