PHP file handling
 Introduction to PHP file handling in Hindi
 Opening a file with PHP in Hindi
 Reading file with PHP in Hindi
 Writing a file with PHP in Hindi
 Closing a file with PHP in Hindi
Introduction to file handling
languages files PHP functions
provide , आप easily files handle Files
handle ability PHP top scripting languages group
web applications database , simple data text
files store प PHP files आप 6
operations perform
 Opening a file
 Reading a file
 Writing a file
 Appending a file
 Closing a file
 Deleting a file
operations PHP perform , आ
Opening a file
Files open PHP fopen() provide method 2
argument pass प argument file , औ आप
mode open mode PHP file ई modes open
modes character represent
modes ग ग operations प
modes
Mode
s
Explanation
r mode files read
r+ mode file read औ file write
w mode files write file प create
w+ mode file read/write operation perform
a mode प file content delete content add
a+ mode आप file read औ data append
x mode आप file data
write file file प error
ग
x+ mode आप read औ write
File operation perform प file
open PHP file open
Opening a file
<?php
$myFile = fopen(“myFile.txt”,”w”);
?>
file open आप file mode
आप open according ई operation perform
Reading from a file
File read आप 2 functions प आप
fread() function function आप file length
प File length pass , compiler प
file content आप filesize()
method आप file pass PHP file read
Reading from a file
<?php
$file1 = fopen(“myFile.txt”,”r+”); // open file
$filesize($file1);
$filedata = fread(“$file1,$filesize”);
?>
Writing to a file
file data store आप fwrite() function
function file pointer औ data pass File pointer variable ,
आप file open point PHP data write
Writing to a file with PHP
<?php
$myFile = fopen(“myFile.txt”, “w”);
fwrite(“myFile”,”This website is cool!”);
?>
Appending to a file
आप existing file data write , file previous data
delete आप previous data delete
end new data add आप file a mode open
औ fwrite() function data आप write
Appending to a file
<?php
$myFile = fopen(“filename.txt”,a); //opening with a mode
fwrite($myFile,”and I am also cool!”);
?>
Closing a file
Operations complete आप file stream close
PHP fclose() method provide method file pointer pass
Closing a file
<?php
$myFile = fopen(“filename.txt”,a); //opening with a mode
// do some operations here
fclose($myFile)
?>
Deleting a file
प आप file delete PHP unlink
method provide
Deleting a file
<?php
$myFile = fopen(“filename.txt”,a); //opening with a mode
//perform some operations here
unlink($myFile)
?>
PHP file handling आप dynamically files handle

Php file handling in Hindi

  • 1.
    PHP file handling Introduction to PHP file handling in Hindi  Opening a file with PHP in Hindi  Reading file with PHP in Hindi  Writing a file with PHP in Hindi  Closing a file with PHP in Hindi Introduction to file handling languages files PHP functions provide , आप easily files handle Files handle ability PHP top scripting languages group web applications database , simple data text files store प PHP files आप 6 operations perform  Opening a file  Reading a file  Writing a file  Appending a file  Closing a file  Deleting a file operations PHP perform , आ Opening a file Files open PHP fopen() provide method 2 argument pass प argument file , औ आप mode open mode PHP file ई modes open modes character represent
  • 2.
    modes ग गoperations प modes Mode s Explanation r mode files read r+ mode file read औ file write w mode files write file प create w+ mode file read/write operation perform a mode प file content delete content add a+ mode आप file read औ data append x mode आप file data write file file प error ग x+ mode आप read औ write File operation perform प file open PHP file open Opening a file <?php $myFile = fopen(“myFile.txt”,”w”); ?> file open आप file mode आप open according ई operation perform Reading from a file
  • 3.
    File read आप2 functions प आप fread() function function आप file length प File length pass , compiler प file content आप filesize() method आप file pass PHP file read Reading from a file <?php $file1 = fopen(“myFile.txt”,”r+”); // open file $filesize($file1); $filedata = fread(“$file1,$filesize”); ?> Writing to a file file data store आप fwrite() function function file pointer औ data pass File pointer variable , आप file open point PHP data write Writing to a file with PHP <?php $myFile = fopen(“myFile.txt”, “w”); fwrite(“myFile”,”This website is cool!”); ?> Appending to a file
  • 4.
    आप existing filedata write , file previous data delete आप previous data delete end new data add आप file a mode open औ fwrite() function data आप write Appending to a file <?php $myFile = fopen(“filename.txt”,a); //opening with a mode fwrite($myFile,”and I am also cool!”); ?> Closing a file Operations complete आप file stream close PHP fclose() method provide method file pointer pass Closing a file <?php $myFile = fopen(“filename.txt”,a); //opening with a mode // do some operations here fclose($myFile) ?> Deleting a file
  • 5.
    प आप filedelete PHP unlink method provide Deleting a file <?php $myFile = fopen(“filename.txt”,a); //opening with a mode //perform some operations here unlink($myFile) ?> PHP file handling आप dynamically files handle