您首先需要解码您的网址,然后将其传递给parse_str
. 第二个参数parse_str
是您的数据将填充的内容。因此,您可以执行以下操作:
parse_str(urldecode('type%3Dbasic%26WhatPropType%3DSingle%2BFamily%2BResidential%26WhatDistrict%255B0%255D%3DHaiku%26WhatStartPrice%3D90000%26WhatEndPrice%3D30000000%26WhatStartBed%3D%26WhatStartBath%3D0%26DaysAgo%3D%26WhatStartIntArea%3D%26WhatSortDirection1%3DDESC%26start%3D0%26WhatNumber%3D10'), $array);
var_dump($array);
将输出
array(12) {
["type"]=>
string(5) "basic"
["WhatPropType"]=>
string(25) "Single Family Residential"
["WhatDistrict"]=>
array(1) {
[0]=>
string(5) "Haiku"
}
["WhatStartPrice"]=>
string(5) "90000"
["WhatEndPrice"]=>
string(8) "30000000"
["WhatStartBed"]=>
string(0) ""
["WhatStartBath"]=>
string(1) "0"
["DaysAgo"]=>
string(0) ""
["WhatStartIntArea"]=>
string(0) ""
["WhatSortDirection1"]=>
string(4) "DESC"
["start"]=>
string(1) "0"
["WhatNumber"]=>
string(2) "10"
}