Re: Putting Evaluated Contents Of Include File Into Varialble
| From: | Marek Kilimajer | Date: | Wed, 23 Feb 2005 12:31:45 +0000 |
| Subject: | Re: Putting Evaluated Contents Of Include File Into Varialble | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209228@lists.php.net to get a copy of this message | ||
Michael Stearne wrote:
Hi, I have an file that contains PHP code..variables, db, etc. Is it possible to include the evaluted contents of that file into a variable in another, the calling PHP script? Essentailly I am looking to do something like include("myCode.php") -> HTML Output -> $myVariable. I know could do this with something like $myVariable=file_get_contents("http://localhost/myCode.php") but I am not allowed to use urls in file opens.use output buffering functions: ob_start(); include("myCode.php"); $myVariable = ob_get_clean(); // available since 4.3.0