开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜