Home  >  Article  >  Backend Development  >  请教a=1&b=2这样的字符串在PHP中有什么好办法解析

请教a=1&b=2这样的字符串在PHP中有什么好办法解析

WBOY
WBOYOriginal
2016-06-13 12:43:43741browse

请问a=1&b=2这样的字符串在PHP中有什么好办法解析
遇到一个问题

某接口会返回a=1&b=2&c=3......这个格式的字符串,参数的数量不太固定,有时候是十来个,有时候是二十个,并且顺序也不太固定,有时候是a=1&b=2&c=3,有时候是b=2&a=1&c=3

我怎么才能方便的获得其中的一个参数的值,比如我想获得里面c的值

试过用explode打断字符串的方式但是感觉特别山寨,有别的函数可以直接用吗

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn