$from = $_SERVER['REQUEST_URI'];
回聲/marketing/clients.php?action=sendbook &問題= 29讓PHP自我和GET變量
如何只得到clients.php?action=sendbook&issue=29
? 謝謝!
$from = $_SERVER['REQUEST_URI'];
回聲/marketing/clients.php?action=sendbook &問題= 29讓PHP自我和GET變量
如何只得到clients.php?action=sendbook&issue=29
? 謝謝!
echo $_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'];
// or (if you have to use $from)
$from = $_SERVER['REQUEST_URI'];
$url = parse_url($from);
echo $url['path']."?".$url['query'];
//or
$url = explode("/",$from);
echo $url[1];
http://php.net/manual/en/function.parse-url.php – Jason 2010-10-28 04:43:14
我會說:'回聲SUBSTR($而來, 12);' – Mischa 2010-10-28 04:51:34
'parse_url'不適用於相對URL(如他的例子)。 – Ben 2010-10-28 04:57:20