take file data in variable php

Solutions on MaxInterview for take file data in variable php by the best coders in the world

showing results for - "take file data in variable php"
Jannik
19 Sep 2017
1I suppose you want to get the content generated by PHP, if so use:
2
3$Vdata = file_get_contents('http://YOUR_HOST/YOUR/FILE.php');
4
5Otherwise if you want to get the source code of the PHP file, its the same as 
6a .txt file:
7
8$Vdata = file_get_contents('path/to/YOUR/FILE.php');
Marlene
01 Jun 2018
1ob_start();
2
3include "yourfile.php";
4
5$myvar = ob_get_clean();
6
7reference :
8https://stackoverflow.com/questions/1272228/how-do-i-load-a-php-file-into-a-variable
9https://secure.php.net/manual/en/function.ob-get-clean.php