|
Posted by jesbuddy07 on 11/02/06 14:57
THANK YOU THANK YOU THANK YOU!!!
Martin Mouritzen wrote:
> On 1 Nov 2006 11:10:05 -0800, "jesbuddy07" <jesbuddy07@gmail.com>
> wrote:
>
> >Can anyone point me to a right direction in terms of using / and ../
> >directives to point to a file using PHP?
> >
> >i'm so confused when to use / or ../ or sometimes even without /.
> >
> >i'm writing php file in a /x/y directory, and the file i want to
> >include resides is /x/z directory. in /x/y directory, I tried the
> >following statements, but none of them works
> >
> >include("x/z");
> >include("/x/z");
> >include("../x/z");
> >
> >can any PHP guru out there please tell me when to use /, ../ or none at
> >all??
>
> I can try:
>
> / at the start means "root".
>
> Let's use your examples, and say that your website is located in the
> folder
> /var/www/sites/somedomain.com/ on the webserver.
>
> then the following is true:
>
> : include("x/z");
> tries to include /var/www/sites/somedomain.com/x/z
>
> :include("/x/z");
> tries to include /x/z
>
> :include("../x/z");
> tries to include /var/www/sites/x/z
>
>
> Most of the time when I include things, I use the variable
> $_SERVER["DOCUMENT_ROOT"] which always points to the root of the
> current website.
>
> Let me know if anything needs clarifying.
>
> --
> best regards,
> Martin Mouritzen.
> http://www.siteloom.dk
Navigation:
[Reply to this message]
|