PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
simonmlewis
DevNet Master
Posts: 4435 Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:
Post
by simonmlewis » Thu Aug 10, 2017 10:02 am
I need to get hold of the URL to identify if it is a /blog/ URL.
I have tried this on PHP7.1, but it is echoing nothing.
Code: Select all
<?php
echo "The query string is: ".$_SERVER['QUERY_STRING'];
?>
What am I doing wrong?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Thu Aug 10, 2017 11:46 am
$_SERVER[QUERY_STRING] is half right.
simonmlewis
DevNet Master
Posts: 4435 Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:
Post
by simonmlewis » Fri Aug 11, 2017 3:10 am
$url = $_SERVER['REQUEST_URI'];
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
thinsoldier
Forum Contributor
Posts: 367 Joined: Fri Jul 20, 2007 11:29 am
Contact:
Post
by thinsoldier » Fri Aug 11, 2017 11:57 am
var_dump( $_SERVER );
And look at all the things you have to choose from. Google the key names to find out more about each.
Warning: I have no idea what I'm talking about.