kevinkhan Posted January 5, 2010 Share Posted January 5, 2010 Im trying to display everthing that is in a txt file in a browser and i want to store all the information in a variable. I tryed this simple code but doesnt work. Any suggestions?? $source_file = 'scan0001.txt'; $fp_s = fopen($source_file, 'r'); echo $fp_s; Quote Link to comment https://forums.phpfreaks.com/topic/187295-trying-to-extract-everything-from-a-txt-file-and-store-it-as-a-variable/ Share on other sites More sharing options...
premiso Posted January 5, 2010 Share Posted January 5, 2010 Use file_get_contents as that was what it was made for: $source_file = 'scan0001.txt'; $fp_s = file_get_contents($source_file); echo $fp_s If you want to use fopen, look at the examples found at fread. Quote Link to comment https://forums.phpfreaks.com/topic/187295-trying-to-extract-everything-from-a-txt-file-and-store-it-as-a-variable/#findComment-989067 Share on other sites More sharing options...
kevinkhan Posted January 5, 2010 Author Share Posted January 5, 2010 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/187295-trying-to-extract-everything-from-a-txt-file-and-store-it-as-a-variable/#findComment-989176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.