Gets the string containing the result of the file execution
To describe the problem, here is a simple model:
For example, there is a file a.php, the content is as follows:
You are welcome:
Logout
There is another file b.php
$s =file_get_contents (' a.php ', 1);
?>
In b.php Although can read the contents of the file a.php, but not the content after execution, if you want to be able to explain the code in PHP, so that $s get the following results, what is the best way?
Welcome you: Zhang San logout
Share to:
------Solution--------------------
Straight require/include in.
------Solution--------------------
$s =file_get_contents (' http://localhost/a.php ');
------Solution--------------------
Include to replace the specific content you want
------Solution--------------------
There's a bracket missing.
Ob_start ();
Include ' a.php ';
$s = Ob_get_clean ();