note 48802 added to function.fputs

From: Date: Fri, 07 Jan 2005 13:34:54 +0000
Subject: note 48802 added to function.fputs
Groups: php.notes 
Request: Send a blank email to php-notes+get-82898@lists.php.net to get a copy of this message
This is an example to write a config to include it in another file <?php // $datei need's CHMOD 777 $datei = "file.txt"; // w+ for open, read first and write the whole file new $handle = fopen($datei, "w+"); fputs($handle, "<"."?"."php \n"); fputs($handle, "\$foo1 = \"$bar1\";\n"); fputs($handle, "\$foo2 = \"$bar2\";\n"); fputs($handle, "\$foo3 = \"$bar3\";\n"); fputs($handle, "\$foo4 = \"$bar4\";\n"); fputs($handle, "?".">"); // Closing file.txt fclose($handle); ?> This code write this in file.txt: <?php $foo1 = "$bar1"; $foo2 = "$bar2"; $foo3 = "$bar3"; $foo4 = "$bar4"; ?> You can now simple include this file. It's very nice to work with txt Databases ---- Manual Page -- http://www.php.net/manual/en/function.fputs.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48802 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48802&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48802&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48802&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48802&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48802&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48802&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48802&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82898) next »