waynew Posted October 19, 2009 Share Posted October 19, 2009 How would one go about getting the relative path to a file from its absolute path? Link to comment https://forums.phpfreaks.com/topic/178274-get-relative-path-from-absolute-path/ Share on other sites More sharing options...
jonsjava Posted October 19, 2009 Share Posted October 19, 2009 a simple way is to remove the document root from the script filename: <?php $rel_path = str_replace($_SERVER['DOCUMENT_ROOT'], "", $_SERVER['SCRIPT_FILENAME']); print $rel_path; Link to comment https://forums.phpfreaks.com/topic/178274-get-relative-path-from-absolute-path/#findComment-940009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.