Jump to content

file_get_contents()


johnmccc

Recommended Posts

Hi

I have a simple file.php like this:

<?php
echo 'Hello';
?>

 

And I have main PHP script where i want to get the previous file.

So i thought must do this:

<?php
$String = file_get_contents('file.php');
echo $String;
?>

 

But this will print "echo 'Hello';"

I want my main PHP file to print "Hello"

 

So the PHP code is not beging processed

How can I solve this?

I cannot use include or require .. because I want to put the output from file.php into a string!

Link to comment
https://forums.phpfreaks.com/topic/205157-file_get_contents/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.