Senior PHP Tutorial

File read and write

fopen(filedir,operate);

operate: r, r +, w, w +, x, x + are read, read, write, read, (write, read and write) If the file already exists behind the two returns false error and

adding additional read a + a

fclose to close the file

feof detects whether the end of file

fgets to read line by line

The character read by fgetc

 

example:

? < PHP
 $ File = fopen ( "1.txt", "r") or Exit ( "Can not open file!" );
 // read each line of the file, the file until the end of 
the while (! Feof ( $ File )) 
{ 
    echo  fgets ( $ File ) "<br>." ;
     echo  fgetc ( $ File ); 
} 
fclose ( $ File );
 ?>

We have the following functions:

basename ()   returns the file name portion of the path.

chgrp ()    to change the file group.

chmod ()   to change the file mode.

chown ()   to change the file owner.

copy()

 

Guess you like

Origin www.cnblogs.com/webcyh/p/11272002.html