note 94067 added to function.file

From: Date: Wed, 14 Oct 2009 22:47:11 +0000
Subject: note 94067 added to function.file
Groups: php.notes 
Request: Send a blank email to php-notes+get-161741@lists.php.net to get a copy of this message
this may be obvious, but it took me a while to figure out what I was doing wrong. So I wanted to share. I have a file on my "c:\" drive. How do I file() it? Don't forget the backslash is special and you have to "escape" the backslash i.e. "\\": <?php $lines = file("C:\\Documents and Settings\\myfile.txt"); foreach($lines as $line) { echo($line); } ?> hope this helps... ---- Server IP: 208.69.120.35 Probable Submitter: 198.246.222.7 ---- Manual Page -- http://www.php.net/manual/en/function.file.php Edit -- https://master.php.net/note/edit/94067 Del: integrated -- https://master.php.net/note/delete/94067/integrated Del: useless -- https://master.php.net/note/delete/94067/useless Del: bad code -- https://master.php.net/note/delete/94067/bad+code Del: spam -- https://master.php.net/note/delete/94067/spam Del: non-english -- https://master.php.net/note/delete/94067/non-english Del: in docs -- https://master.php.net/note/delete/94067/in+docs Del: other reasons-- https://master.php.net/note/delete/94067 Reject -- https://master.php.net/note/reject/94067 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161741) next »