shashiku Posted July 25, 2007 Share Posted July 25, 2007 hi i tried the exec() to open a txt file. but iam not sure how to use it. can u pls help me this is the code i tried <?php exec(" C:\wamp\www\web\hello.txt"); ?> the notepad.exe seem to run in the task manager when i run the script. but the file doesnt open. pls correct me with the correct code Link to comment https://forums.phpfreaks.com/topic/61680-how-to-open-a-text-file-using-a-php-script/ Share on other sites More sharing options...
pocobueno1388 Posted July 25, 2007 Share Posted July 25, 2007 Open a txt file: http://www.tizag.com/phpT/fileopen.php Write to a text file: http://www.tizag.com/phpT/filewrite.php Show the contents of the file: http://www.php.net/file Link to comment https://forums.phpfreaks.com/topic/61680-how-to-open-a-text-file-using-a-php-script/#findComment-307030 Share on other sites More sharing options...
shashiku Posted July 25, 2007 Author Share Posted July 25, 2007 what i need is i want to the script to open the text file in the notepad it self. fopen only opens it in background. i want to execute the file. Link to comment https://forums.phpfreaks.com/topic/61680-how-to-open-a-text-file-using-a-php-script/#findComment-307034 Share on other sites More sharing options...
plutomed Posted July 25, 2007 Share Posted July 25, 2007 <textarea cols="100" rows="20" name="edited_data"> <? $file = fopen("testing.php", "r") or die("Cannot open file"); while (!feof($file)) { echo fgetc($file); } fclose($file); ?> </textarea> ?> thats seemed to work for me. Link to comment https://forums.phpfreaks.com/topic/61680-how-to-open-a-text-file-using-a-php-script/#findComment-307040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.