There is a header.php file and contains some php codes that return HTML. I know that I can use require, include for echoing results, but I want to save the processed output string to a variable.
On the page, I used:
$headerHTML=file_get_contents('header.php');
Then I got the output of the PHP code, not the processed HTML output. I know adding http: // will help. But I prefer to use a relative path, how can I say that the function correctly processes the php file?
Note. I would like to continue to use this file_get_contents statement, rather than using ob_start() if possible.
source share