PHP file_get_contents after php evaluation

I know how to use file_get_contents and fopen, etc., but when I do this with one of my own file, I get a literal string, that is, the code is not preprocessed! How can I import text from a file without using require, etc., because I want to keep the value in a string

+4
source share
1 answer

See examples No. 5 and No. 6 in the manual . Taken right from there:

$string = get_include_contents('somefile.php'); function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; } 
+9
source

All Articles