note 71010 deleted from function.fwrite by bobby

From: Date: Wed, 08 Nov 2006 06:04:47 +0000
Subject: note 71010 deleted from function.fwrite by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119504@lists.php.net to get a copy of this message
Note Submitter: asbo at iserv dot net ---- In writing a script that produces .htaccess and .htpasswd files, I discovered that in order to produce a blank line at the end of a file (which is required for the two aforementioned files to be interpreted correctly), you just double up the newline character, i.e.: <? $f = fopen('.htpasswd','w'); fwrite('foo:abc123'."\n"); // yields no trailing blank line. fclose($f); $f = fopen('.htpasswd','w'); fwrite('foo:abc123'."\n"); // DOES yield a trailing blank line. fclose($f); ?> Hope this saves someone else some time.

« previous php.notes (#119504) next »