I'm somewhat new to PHP. I'm not sure how to point to the root of my web site in a function. I was using $_SERVER["DOCUMENT_ROOT"], but when I use it in my function it comes back:
"http://mywebsite.com/var/www/html/mypath"
Note - this is in the HTML - other parts of the function seem to use the path, but when it is used for a link or as the src for an image, it adds the "var/www/html/".
function myFunction($path = "/mypath/") {
$path_to_be = $_SERVER["DOCUMENT_ROOT"];
$first_path = $path_to_be.$path;
}
I tried using $_SERVER["HTTP_HOST"], but that doesn't seem to work either.
What is it that I do not understand? Thanks for any help.