Multiple HTTP GET parameters with the same identifier

前端 未结 5 799
孤独总比滥情好
孤独总比滥情好 2020-12-03 14:47

Let\'s say I am getting requests such as:

http://www.example.com/index.php?id=123&version=3&id=234&version=4

Is it possible to extra

5条回答
  •  伪装坚强ぢ
    2020-12-03 15:15

    If you can change the field name to include [], then PHP will create an array containing all of the matching values:

    http://www.example.com/index.php?id[]=123&version[]=3&id[]=234&version[]=4
    

    If you don't have the ability to change the field names, then as you say, you'll have to parse the querystring yourself.

提交回复
热议问题