This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_current_dir(){ | |
$file = realpath(dirname(__FILE__)); // Current file path | |
$patt = '/\/path\/to\/public\/directory/'; // Regex pattern for all non-public directories | |
$url = preg_replace($patt,'', $file); // Take out those non-public directories | |
return $url . '/'; // Return the URL with a trailing slash | |
} | |
/** | |
* This function may be useful for occasions where you need to call a file in PHP included in the same directory |