PHP Get URL with Parameter

后端 未结 5 1052
迷失自我
迷失自我 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:12

    for complette URL with protocol, servername and parameters:

     $base_url = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 'https' : 'http' ) . '://' .  $_SERVER['HTTP_HOST'];
     $url = $base_url . $_SERVER["REQUEST_URI"];
    

提交回复
热议问题