获取php self并获取变量
echo/marketing/clients.php?action=sendbook&issue=29 如何获取获取php self并获取变量,php,Php,echo/marketing/clients.php?action=sendbook&issue=29 如何获取clients.php?仅限action=sendbook&issue=29? 谢谢大家! $from = $_SERVER['REQUEST_URI']; 甚至更容易 $temp = explode("/",$from); $temp = end($temp); 甚至更容易 $temp = explode("/",$from); $temp = end($temp); 我会说:
clients.php?仅限action=sendbook&issue=29
?
谢谢大家!
$from = $_SERVER['REQUEST_URI'];
甚至更容易
$temp = explode("/",$from);
$temp = end($temp);
甚至更容易
$temp = explode("/",$from);
$temp = end($temp);
我会说:
echosubstr($from,12)
parse_url
无法处理相对url(如他的示例所示)。@Steve?为我工作。在手册中:“部分url也被接受,parse_url()
尽最大努力正确解析它们。”手册说没有(在“注释”部分),但我还没有测试自己……我想说:echo substr($From,12)
parse_url
无法处理相对url(如他的示例所示)。@Steve?为我工作。从手册中可以看出:“部分url也被接受,parse_url()
尽最大努力正确解析它们。”手册说没有(在“注释”部分),但我还没有测试过自己……比如basename()
。好的,我来。hahaI遵循“特殊奥运”规则(尽管我觉得这很讨厌)。没有恶意。例如basename()
。好的,我来。hahaI遵循“特殊奥运”规则(尽管我觉得这很讨厌)。没有敌意。
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];