Re: using fwrite to create PHP files

From: Date: Fri, 05 Sep 2003 18:32:49 +0000
Subject: Re: using fwrite to create PHP files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161813@lists.php.net to get a copy of this message
Vince LaMonica wrote:
I wish to use fwrite() to create a small PHP file. So far, when I attempt to do this, php parses the contents of the file that fwrite needs to create. Eg, I have this: $new_id = mysql_insert_id(); // create brand new file $new_file = fopen("/var/www/html/$sitename/$submitted_url", "w"); $new_file_content = "\n" ." <?php \n" ." if ($_GET['preview'] == \"y\") { \n"
You need to escape the dollar signs in your string. ." if (\$_GET['preview'] == \"y\") { \n" -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#161813) next »