php - Get the URL of current script even if it's included? -


i have php script needs know it's url, if it's included within script. i've tried:

$_server['request_uri'] 

but doesn't return uri script--rather, returns uri including script. i've tried:

dirname ( __file__ ) 

but can't seem convert absolute url.

can script find own url, if it's being included in script? help!

i think can't, @ least not in robust , portable way. php encourages developers think url maps directly script, 1 may convinced each script s there's function(s) gives public url.

unfortunately, not true. quick reference, think of mod_rewrite or chance script may requested reverse proxy.

if need functionality, have design mistake, if tell problem (in terms of functionality, not implementation) may come right solution you.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -