Imprettynew1 Posted February 8, 2013 Share Posted February 8, 2013 (edited) Like most that start threads like this. I will have to say I'm pretty new. <head> <?php include('http://www.example.ca/includes.php'); ?> </head> The above snippet of code fails to load a site the way I want. However the snippet of code below does work. <head> <?php include('./includes.php'); ?> </head> I just need to understand why - Is the first example and path, not the same as the second example? Please and thank you. Edited February 8, 2013 by Imprettynew1 Quote Link to comment https://forums.phpfreaks.com/topic/274228-reason-why-this-works-the-way-it-does/ Share on other sites More sharing options...
DaveyK Posted February 8, 2013 Share Posted February 8, 2013 http://php.net/function.include Appearantly you need to set "allow_url_fopen" Quote Link to comment https://forums.phpfreaks.com/topic/274228-reason-why-this-works-the-way-it-does/#findComment-1411128 Share on other sites More sharing options...
Barand Posted February 8, 2013 Share Posted February 8, 2013 (edited) You have to include files using file system paths on your server, not with URLs. Guess I was using PHP4 last time I read that section of the manual Edited February 8, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/274228-reason-why-this-works-the-way-it-does/#findComment-1411131 Share on other sites More sharing options...
SofWare Posted February 8, 2013 Share Posted February 8, 2013 Please could you specify what you mean by the code doesn't load in the way you want. Quote Link to comment https://forums.phpfreaks.com/topic/274228-reason-why-this-works-the-way-it-does/#findComment-1411173 Share on other sites More sharing options...
trq Posted February 8, 2013 Share Posted February 8, 2013 Is the first example and path, not the same as the second example? No, the first example makes a request to the url provided. This returns the output of the php script requested after it has already been processed. The second, actually includes the php script into your current script ready to be processed. Quote Link to comment https://forums.phpfreaks.com/topic/274228-reason-why-this-works-the-way-it-does/#findComment-1411179 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.