How do I load a PHP file into a variable?

后端 未结 8 1473
清歌不尽
清歌不尽 2020-11-30 19:20

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(\"text         


        
8条回答
  •  借酒劲吻你
    2020-11-30 19:59

    If you want to load the file without running it through the webserver, the following should work.

    $string = eval(file_get_contents("file.php"));

    This will load then evaluate the file contents. The PHP file will need to be fully formed with and ?> tags for eval to evaluate it.

提交回复
热议问题