在我有一个 php 文件
include_once($_SERVER['document_root'] .'/path/to/file.php');
当我查看包含例如 test.php 中的代码的文件时,如果我有此 URL 格式,它可以正常工作:
http://www.example.com/path/to/test.php
但如果它是一个子域,像这样:
http://path.example.com/to/test.php
我收到一条错误消息,指出该文件的路径file.php
不included
存在。
我试过输入一个完整的 url include_once('http://www.example.com/path/to/file.php');
。
我怎样才能让它在子域下工作?