我有这个数组,我想获取1的值并将其保存为变量。我怎么做?解析URL的访问值
Array
(
[scheme] => http
[host] => pianotunerpros.com
[path] => /techportal/profile/
[query] => 1
)
下面是我用它来获取
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
print_r(parse_url(curPageURL()));
echo parse_url($url, PHP_URL_PATH);
你可能想给这个快速阅读,http://www.php.net/手册/ zh/introduction.php – Adrian