How can I convert directory path to full URL
I want to convert directory paths to absolute URLs. For eg.
C:\example\myfile to http://e开发者_开发问答xample.com/myfile
How can I do this? Please help me.
Use the $_SERVER['SERVER_NAME'] property to get the domain you are running on, then append it to the root of your file location.
i.e. If file is in C:\www\mydir\myfile.file, then
$url = $_SERVER['SERVER_NAME'].'/mydir/myfile.file';
Use preg_replace.
精彩评论