php - Get slug from current url -


i getting urls in following patterns:

http://localhost/hi-every-body/ http://s1.localhost/hello-world/ http://s2.localhost/bye-world/ 

and want fetch exact slug like

hi-every-body hello-world bye-world 

with few check & few line of code. tried many checks appeared.

this should that:

trim(parse_url($url, php_url_path), '/'); 

it takes path , strips off slashes on both sides.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -