我的问题的一个例子:
我在域(例如)“root.co.uk”的文档根目录(htdocs 或其他任何内容)中有一个脚本,我想在其中生成指向“文件”域的链接:
/htdocs/include.file.php
<?php
echo $_SERVER['HTTP_HOST']; // another.com -> but I like to have "root.co.uk" here :(
?>
现在我有一个域(例如)“another.com”的子文件夹,它将通过浏览器加载:
/htdocs/another.com/index.php -> http://www.another.com
<?php
include('/htdocs/include.file.php'); // Include file from "root.co.uk"
?>
有没有办法传递域名?据我所知,唯一的解决方案是定义一个像 $maindomain = 'root.co.uk' 这样的变量。但这不是我喜欢的方式。:(
感谢您的任何想法!