un include?
| From: | jekillen | Date: | Sun, 11 Feb 2007 04:18:24 +0000 |
| Subject: | un include? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248724@lists.php.net to get a copy of this message | ||
Hello all;
Is there a way to un include a file once it has been included in a script?
I have a situation where I need to include a php file for a variable and
its value. Then I need to open the file and modify it in the same function
'that included the file. So far the function, as I test it does not appear
to be making the intended changes to the file that has been included.
And I am not getting any error messages.
Am I asking too much:
$fileToInclude = 'some_file.php';
function edit_included_file( $fileToInclude)
{
include($fileToInclude);
// use some variable in it
$fr = fopen($fileToInclude, 'r');
$str = fread($fr, filesize($fileToInclude))
fclose($fr);
// make alterations to $str
// reopen file and write the changes
// done but in test function I have written changes have not been made
}
looked through the O'Reilly book Programming Php and could not find
a clue.
Thanks in advance
Jeff K