想要将文件从主域包含到子域
index.php - subdomain.example.com
ini_set("allow_url_fopen", 1);
ini_set("allow_url_include", 1);
$host = $_SERVER['HTTP_HOST'];
if($host == 'localhost'){include("../navt.php");}
else{include("https://example.com/navt.php");}
在本地主机上 - 没有问题(win 10、xampp、chrome)
在远程服务器上 - 我仍然得到这个:
include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
答案 0 :(得分:1)
documentation for the allow_url_include
setting 包含两个重要细节:
两者都是出于相同的原因:此设置极其危险。强烈建议您考虑如何部署代码,为您的问题提出替代解决方案。例如:
include
引用这些文件。