RE: [PHP] fopen on windows
| From: | Ford, Mike | Date: | Mon, 14 Nov 2005 14:22:49 +0000 |
| Subject: | RE: [PHP] fopen on windows | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-225735@lists.php.net to get a copy of this message | ||
On 11 November 2005 21:21, Nathan Tobik wrote:
> I've always used:
>
> fopen("C:\\dir\\dir\\file.txt");
>
> on windows, I'm not sure how PHP interprets the slashes internally
> though...
On Windows, "/" in filenames is internally translated by PHP to "\" -- which
means you can write code that works on both Windows and *n*x using "/". *Really* portable
code uses the DIRECTORY_SEPARATOR constant, however.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm