Page 1 of 1

Require_once

Posted: Fri Jan 27, 2012 2:08 pm
by YoussefSiblini
Hi Guys,
I am having trouble here,
when I use this code

Code: Select all

<?php include "includes/header.php" ?>
every thing works fine:

But when I use the full url to that file like this

Code: Select all

<?php include "http://www.mydomain.com/includes/header.php" ?>
it doesn't work.


As I have a big website I need to use the full path.


Youssef

Re: Require_once

Posted: Fri Jan 27, 2012 4:32 pm
by YoussefSiblini
Ignore this guys as I sorted it out, I used $_SERVER['DOCUMENT_ROOT'] :)

Re: Require_once

Posted: Fri Jan 27, 2012 4:45 pm
by social_experiment
fyi
The Manual wrote: If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname.

Re: Require_once

Posted: Fri Jan 27, 2012 5:10 pm
by YoussefSiblini
Thank you,
I prefer $_SERVER['DOCUMENT_ROOT'] because it works in both local and live environment.

Youssef