PHP: get full URL of current page with GET params or without

Written by

on

in

, ,

The following string variable’s value will get the full URL of the current page, including GET arguments/params, if present.

To get the full URL of current page but WITHOUT the GET args/params, do this instead:

The strtok function will return only the part of the URL string up to the character before question mark “?” which is used by GET args/params.

strtok was suggested in this StackOverflow answer: http://stackoverflow.com/a/4643312

Related Posts

About the author:

Catzie Avatar

The homo sapiens behind these blog posts is “Catzie“

Explore my top blog posts:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *