1
我想從以下網址獲取方法ID,如何從URL得到具體的參數在PHP
我用下面的代碼獲取URL
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
$url = $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
結果:
http://www.mydomain.com/post-file.php?id=154&[email protected]&method=2&reference=uhr748
我想從上面的URL獲得方法ID,即2