executing php used in file_get_contents

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

executing php used in file_get_contents

Post by mickd »

hi, as an example i have these 2 pages

test1.php

Code: Select all

<?php
$title = 'THIS BETTER WORK!';
?>

<html>
<head>
<title><?php echo $title; ?></title>
</head>

<body>
</body>
</html>
and

test.php

Code: Select all

<?php

echo (file_get_contents('test1.php');

?>
the problem is probably obvious but just incase, how do you get it so that in the test.php itll display it as if it was test1.php.

thanks for any help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

include()

file_get_contents() simply reads the file as is, nothing more.
Post Reply