Using Variables inside file get contents

0 Shamal Sandeep · October 6, 2014
I have a script like this


<?php
$int = 1;
$var = "name";

if($int >= 1){
$page = file_get_contents('li.raw')
echo $page;
} else {

}

 So my li.raw is like follows



<?php

    echo $var;




but this does not show name value in the page. I tried without php tags but it doesn't work. any idea how i call $var variable inside the li.raw file ?

Post a Reply

Replies

Oldest  Newest  Rating
0 Samuel Oloruntoba · October 7, 2014
yeah, just include the file, or you could get the contents and use evel function on the returned output, THIS METHOD IS NOT ADVICED
0 Pieter Moens · October 7, 2014
Have you tried to just include the file?

<?php
include 'li.raw';
?>


I don't know, but it might work.

Kind regards,
Pieter Moens
  • 1

PHP

107,116 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators