Organizational Research By

Surprising Reserch Topic

get url path in php using -'php,url'


get url path in php  using -'php,url'

I have a quick question in php.

I need to get the current page url, and then find the path. For example, if the current url is:

"http://www.example.com/example/test/hi.php?randomvariable=1"


I would want this:

"/example/test/hi.php?randomvariable=1"


Thank you!
    

asked Sep 8, 2015 by rajesh
0 votes
12 views



Related Hot Questions

1 Answer

0 votes
you can use: <?php $url = '//www.example.com/path?googleguy=googley'; // Prior to 5.4.7 this would show the path as "//www.example.com/path" var_dump(parse_url($url)); ?> return this: array(3) { ["host"]=> string(15) "www.example.com" ["path"]=> string(5) "/path" ["query"]=> string(17) "googleguy=googley" }
answered Sep 8, 2015 by rajesh

...