lundi 29 juin 2015

Can't get php to display access.txt file in html

This may be a noob question. In which case, sorry. I can't get this php script to read the contents of a txt file in the same directory. It outputs

';?>

and

.$theData.

here is the code

<article> 
<?php
$Color = "red";
$myFile = "access.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 5);
fclose($fh);
echo '<div style="Color:'.$Color.'">'.$theData.'</div>';
?>
</article>

Aucun commentaire:

Enregistrer un commentaire