PHP text script

mikel2k3

New Member
Messages
748
Reaction score
0
Points
0
Hey,
Im just wondering if there is a script that will read the text from a normal .txt file, and then insert it somewhere on a normal .html page?

Ive looked around for it and cant really find one. It seems like a simple thing, so if anybody could find/write one that would be rgeat.

Thanks,
Mike
 

Chris Z

Active Member
Messages
5,603
Reaction score
0
Points
36
This should work:
PHP:
<?php
$file = 'path/to/file/here.php';
include($file);
?>
 
Last edited:

CascadesAdmin

New Member
Messages
87
Reaction score
0
Points
0
try this:

PHP:
<?php include("filename.txt"); ?>
<h1>Welcome to my home page</h1>
<p>Some text</p>
</body>
</html>

or try

PHP:
<html>
<body>
<?php
$file=fopen("welcome.txt","r") or exit("Unable to open file!");

// Tells when The File has reached the end. You can remove
if (feof($file)) echo "End of file"; 

?>
</body>
</html>
 
Last edited:
Top