| |
The PHP developers network
630 hits
Apr 16, 2004 6:25 pm |
|
re: Creating a PHP file on the fly |
Peter Harkins
| |
// Here's some off-the-cuff code. It won't handle arrays, but you could write a recursive function to do so pretty easy (I've code you can take and tweak at http://push.cx/php/escape.phps).
// the message board code is being dumb, so the [?PHP and such will have to get replaced with proper open and close tags
$fh = fopen("/var/www/blah.php");
fwrite($fh, "[?PHP\n");
foreach($config_array as $key => $value) {
fwrite($fh, "$key = '$value';\n");
}
fwrite($fh, "?]\n");
fclose($fh);
Private Reply to Peter Harkins (new win) |
|