【发布时间】:2026-01-15 08:05:02
【问题描述】:
我有这种类型的网址:
http://mysite.com/results.php?location=montreal&car-rental=no&add-hotel=no&moods%5B%5D=Adventure&moods%5B%5D=Arts&moods%5B%5D=Culture&moods%5B%5D=Well-being&moods%5B%5D=Zen&weather-dependent=yes
在 PHP 中,仅获取 $_GET[] 部分的最佳方法是什么?
例如:
$get = location=montreal&car-rental=no&add-hotel=no&moods%5B%5D=Adventure&moods%5B%5D=Arts&moods%5B%5D=Culture&moods%5B%5D=Well-being&moods%5B%5D=Zen&weather-dependent=yes
谢谢。
【问题讨论】:
-
explode问号? -
你的意思是查询字符串?
$_SERVER['QUERY_STRING']familiarize yourself with the contents of$_SERVER