Re: Include files beneath pointed directory

From: Date: Thu, 18 Jan 2007 22:47:40 +0000
Subject: Re: Include files beneath pointed directory
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-247367@lists.php.net to get a copy of this message
Wikus Moller wrote:
Hi. I have a windows server and I know this issue has been dealt with before but I can't find it, I want to include a file from a directory beneath or aside my home directory. Can I use the C:\directory\anotherdirectory\file.php in the include function like include "C:\directory\anotherdirectory\file.php"; or do I need more code to make it work? I am sure I do. The directory would be aside my home directory.
That should work fine in theory. I'd suggest using the constant 'DIRECTORY_SEPARATOR' instead: $path = 'c:' . DIRECTORY_SEPARATOR . 'directory' ..... so you don't have to worry about escaping backslashes, otherwise you have to write it as: c:\\directory\\ ... or c:/directory/.... Both of those should work ok but using the constant you shouldn't have any problems with forgetting about escaping a \ . -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#247367) next »