fopen (), followed by the argument,
For example: R
r+
A read-only mode, a read-write mode, exactly what is the difference Ah, why create a back this mode?
Can you pass an example to let me know?
Reply to discussion (solution)
R, can only read fread, cannot write fwrite
R+, both can, and overwrite write
$FN = ' abc.txt '; The file name to be manipulated File_put_contents ($FN, ' 12345 '); Write test Data ReadFile ($FN); Look, the content is 12345//r read-only mode $fp = fopen ($FN, ' R '); $c = Fgetc ($FP); echo $c; Echo fputs ($fp, ' a '); 0 No characters are written to fclose ($FP); ReadFile ($FN); Look, the content of 12345 does not change//r+ read-write mode $fp = fopen ($fn, ' r+ '); $c = Fgetc ($FP); echo $c; Echo fputs ($fp, ' a '); 1 Write 1 characters fclose ($FP); ReadFile ($FN); Look again, the content is 1a345
R can only read the content inside, no permission to write in the file
R+ can write it inside.