Pages

Your Ad Here

This Blog is not to read or go through

because, I have never been such a mess


Search the blog instead

Tuesday, May 17, 2011

base_url() function for php



function base_url(){
    $pathinfo = pathinfo($_SERVER["SCRIPT_NAME"]);
    $dirname = $pathinfo["dirname"];
    if($_SERVER["HTTPS"] == "on"){
    $protocol = "https";
    }else{
        $protocol = "http";
    }
    $base_url = $protocol."://".$_SERVER["HTTP_HOST"].$dirname."/";
    return $base_url;
}

No comments:

Your Ad Here