如何从javascript中获取主页的url包括?

I have a page with a header include, and the include needs a phone number to change on it ONLY if the filename of the current page contains a certain word.

Normally, for a change that is not within an include, the below code would work.

<?php if (strpos($_SERVER['REQUEST_URI'],'example-match') !== false) 
{
    echo '555-555-5555';
} 
else 
{
    echo '1-800-555-5555';
}
?>

However, since the code is in an included file on the page, rather than the original page itself, the server instead is returning the name of that included file.

Example: www.example.com/im-on-this-page.html returns the name of the include the php file is in - www.example.com/header-include.php.

Is there a way to grab the URL of the page the include is "included on", rather than the url of the include, from code that is within the include?

UPDATE:

The file is being included via Javascript, since the page is it being included on is an html file:

<script>
$('#Header').load('/includes/header.php');
</script>

As of your last comment:

Then it is not an include but a GET request to the PHP delivering a JavaScript. And then, the given URL is proper. In order to find out from where the script has been included you may either look for the referer header (which is instable) or pass the current file to the script itself:

<script> $('#Header')
 .load('/includes/header.php?from=encodeUriComponent("<?php echo $_SERVER['REQUEST_URI'] ?php>")'); </script> 

Within your script, instead of $_SERVER['REQUEST_URI'] then use $_GET['from']

As commentors have mentioned as well. This is incorrect. $_SERVER does not change for the duration of the script (and includes). Including a file will not alter it.

A javascript include, meaning it is actually called by the client by an ajax call, and not included on the server before the page is presented. (you load a page, and then load another page which you "print" somewhere on the first)

a quick and dirty fix would be to write something along these lines on the first php file

<?php if (strpos($_SERVER['REQUEST_URI'],'example-match') !== false) 
{
    echo "<script> var phone_number = '555-555-5555';</script>";
} 
else 
{
    echo "<script> var phone_number = '1-800-555-5555';</script>";
}
?>

which will create a variable on the client side, which you then can call from the loaded page as a javascript variable