witakr Posted April 26, 2007 Share Posted April 26, 2007 I have a list of txt files that i use to store data from my script. I need to be able to get the list of all files in the certain directory then echo the name of the files minus the extensions and then echo the contents of each file Can some one help? ...lol thnx j Link to comment https://forums.phpfreaks.com/topic/48738-file-names-and-contents/ Share on other sites More sharing options...
boo_lolly Posted April 26, 2007 Share Posted April 26, 2007 read the manual. Link to comment https://forums.phpfreaks.com/topic/48738-file-names-and-contents/#findComment-238876 Share on other sites More sharing options...
witakr Posted April 26, 2007 Author Share Posted April 26, 2007 Yeah, i tried that, php.net confuses me still because im still learning... this is what i have thusfar... so i got the dir listing.. i just don't know how to strip the unwanted characters... $files = glob("$filesdir*.txt"); foreach ($files AS $file) { $filecon = file_get_contents($file); echo $file."<BR><BR>"; //echo $filecon."<BR>"; } the output is playerfiles/dsxfv.txt playerfiles/jason.txt playerfiles/jeff.txt playerfiles/jimmy.txt playerfiles/mindy.txt playerfiles/ron.txt i need "playerfiles/" and ".txt" stripped, leaving just the person's name Link to comment https://forums.phpfreaks.com/topic/48738-file-names-and-contents/#findComment-238877 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.