Alex Rivera | Logout

How do I load a PHP file into a variable?

Asked 2009-08-13T14:15:30.003
111

I need to load a PHP file into a variable. Like include();

I have loaded a simple HTML file like this:

$Vdata = file_get_contents("textfile.txt");

But now I need to load a PHP file.

Edit
Report

1 Answer

3

Alternatively, you can start output buffering, do an include/require, and then stop buffering. With ob_get_contents(), you can just get the stuff that was outputted by that other PHP file into a variable.

answered 2009-08-13T15:48:39.727

Your Answer