简体   繁体   中英

How to include file in subdomain from main domain

I have one main domain and one subdomain example main domain have.

header.php --> index.php --> footer.php and sub domain have index.php I want to include the main domain index.php in subdomain for example like

include '../index.php';
include '../public_html/home/xxxxx/index.php';

but its not working. Now I want to include header.php from main domain in index.php which is in sub domain. By using the include function I get the error failed to open stream: No such file or directory in /home/content/xx/xxx/xxxx/xxx/

I know that this error occurs when a file does not exists on the given mentioned path, but how can I include a file from main domain to subdomain? thank you in advance

You can use the full patch.Without any problem

 define("URLSITEPATH1",(isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]");
include URLSITEPATH1.'/index.php';
include URLSITEPATH1.'/YourPatch/index.php';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM