Blog Introductions


In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services.Php read File write file and delete file Php files | Php tutorials Bestitworriors 


Php read File write file and delete file Php files





Php tutorials



Php read File write file and delete file Php files | Php tutorials Bestitworriors - Php files is important for any website . We can perform various function on file . Following function perform on file oper,read,write,and close the file.We use file for multiple task in website or web application to create file and store data and retrive data and update or overrite data on file . The fopen() function use to open the file.

Some Key Points of PHP File


  1. fopen() is used to open the file
  2. File can be open with mode
  3. Use r to open the file for read only
  4. Use w to open the file for write only
  5. Use a to open the file for write only
  6. Use x to create a new file for write only
  7. Use r+ to Open for read and wirte
  8. Use w+ to open for read and write
  9. Use a+ to open for read and write
  10. Use x+ to open for read and write



Code




<?php
// Write file
$myfilename = fopen("myfile.txt", "w") or die("Unable to open file!");
$text = "Write name for file\n";
fwrite($myfilename, $text);
$txt = "Jane Doe\n";
fwrite($myfilename, $txt);
fclose($myfilename);

//Read file
$file = fopen("myfile.txt", "r") or die("Unable to open file!");
echo fread($file,filesize("myfile.txt"));
fclose($file);


?>







I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about Php read File write file and delete file Php files | Php tutorials Bestitworriors