PHP Get URL with Parameter

后端 未结 5 1050
迷失自我
迷失自我 2021-02-01 15:45

I want to get a URL and its parameters. Example:

www.someweb.com/somepage.php?id=10

How to get only

5条回答
  •  梦如初夏
    2021-02-01 16:00

    $_SERVER['PHP_SELF'] for the page name and $_GET['id'] for a specific parameter.

    try print_r($_GET); to print out all the parameters.

    for your request echo $_SERVER['PHP_SELF']."?id=".$_GET['id'];

    return all the parameters echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];

提交回复
热议问题