note 18051 added to function.eval
| From: | roland at astrofoto dot org | Date: | Tue, 08 Jan 2002 20:57:18 +0000 |
| Subject: | note 18051 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24553@lists.php.net to get a copy of this message | ||
If you are trying to eval() somehthing which is a fully-formed PHP file,
you will need to prepend '?>' to the string. For example, if you have
a script mypage.php which loads example.php and evaluate it:
--- file: example.php ---
<?php phpinfo(); ?>
--- file: mypage.php ---
<?php
$string = implode ('', @file('example.php'));
// Massage the contents of $string however you want.
eval ('?>' . $string);
?>
--
http://www.php.net/manual/en/function.eval.php
http://master.php.net/manage/user-notes.php?action=edit+18051
http://master.php.net/manage/user-notes.php?action=delete+18051
http://master.php.net/manage/user-notes.php?action=reject+18051