teddy777 Posted March 25, 2009 Share Posted March 25, 2009 hi i'm trying to include text from a file on my webpage, i want to continually change this file so I can't just write it in html. This is the code I've tried so far, it didn't work <?php $file = file_get_contents(filename.txt); echo $file; ?> Link to comment https://forums.phpfreaks.com/topic/151082-including-text-from-a-file/ Share on other sites More sharing options...
trq Posted March 25, 2009 Share Posted March 25, 2009 <?php $file = file_get_contents('filename.txt'); echo $file; ?> Link to comment https://forums.phpfreaks.com/topic/151082-including-text-from-a-file/#findComment-793682 Share on other sites More sharing options...
teddy777 Posted March 25, 2009 Author Share Posted March 25, 2009 sorry that was an error copying the code to here, I did include quatation marks in my real code Link to comment https://forums.phpfreaks.com/topic/151082-including-text-from-a-file/#findComment-793684 Share on other sites More sharing options...
PFMaBiSmAd Posted March 25, 2009 Share Posted March 25, 2009 You should be directly copy/pasting code so that people are not wasting time trying to fix nonexistent problems with it. You should also be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON so that you get immediate feedback of problems php finds, like a file name in a function call that should be enclosed in quotes. Link to comment https://forums.phpfreaks.com/topic/151082-including-text-from-a-file/#findComment-793688 Share on other sites More sharing options...
teddy777 Posted March 25, 2009 Author Share Posted March 25, 2009 I put my code through a syntax checker(everything OK), but due to it being in my html code if the code went wrong and I included your code to report errors I still can't see them. Link to comment https://forums.phpfreaks.com/topic/151082-including-text-from-a-file/#findComment-793694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.