post - PHP - Get the end of a URL -


so think need submit new question this...

here old question: php - path minus root

i need way in php take url being of following...

http://kenthomes.net/plan_detail.php?mod=39 http://kenthomes.net/amelia-cove 

and after leaving me with...

"plan_detail.php?mod=39" // if there no alias page 

or

"amelia-cove" // if page has alias being applied 

in reality, same page, because of alias, not of these pages have aliases associated them such as...

http://kenthomes.net/plan_detail.php?mod=52 

unlike...

http://kenthomes.net/amelia-cove 

currently using...

trim($_server['request_uri'],'/') 

which gives me...

"amelia-cove" // fine. 

or

"plan_detail.php" // not okay. 

i need..

"amelia-cove" // fine. 

or

"plan_detail.php?mod=39" // fine. 

how do this?

you can parts of url via parse_url()

for example;

$parts = parse_url('http://kenthomes.net/plan_detail.php?mod=39');  print_r($parts); 

should give this:

array (     [scheme] => http     [host] => kenthomes.net     [path] => /plan_detail.php     [query] => mod=39 ) 

which can use create own url containing parts need


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -