Trying to get a full URL without filename in PHP

后端 未结 7 1746
鱼传尺愫
鱼传尺愫 2020-12-31 01:32

I thought this would be simple but I can\'t seem to find a variable of $_SERVER array that has what I\'m looking for.

Let\'s say my url is http://

7条回答
  •  误落风尘
    2020-12-31 02:13

    I can't seem to find a variable of $_SERVER array that has what I'm looking for.

    because it's fictional string, existing only in the browser's address bar.
    It's parts being sent to server separated.

    I want to know if there's a var of the _server array

    That's very easy to know. just print_r($_SERVER); really simple.

    I know I could quite easily do this with some string manipulation

    yeah. the code you have to write is less than this question text.

    but with some manual magic it can be reduced to just one function.

提交回复
热议问题