1. write files 1. open the resource (file) fopen ($ filename, $ mode) 2. write file fwrite ($ handle, $ str) 3. close the file fclose ($ handle) 4. write file_put_contents ($ filename, $ str, $ mode) FILE_APPENDLOCK_EX} in one step. 2. read File 1. read file fread ($ handle, number of bytes) & amp; nbsp; 2. read a row fgets ($ hand... 1. write files 1. open the resource (file) fopen ($ filename, $ mode) 2. write file fwrite ($ handle, $ str) 3. close the file fclose ($ handle) 4. write file_put_contents ($ filename, $ str, $ mode) FILE_APPEND LOCK_EX} in one step. read File 1. read file fread ($ handle, number of bytes) 2. read a row fgets ($ handle); 3. read a character fgetc ($ handle) 4. read into an array file ($ filename) 5. read file_get_contents ($ filename) step 3. Directory operation 1, create directory mkdir ($ dirname) 2, delete directory rmdir ($ dirname) 3, open directory handle opendir ($ dirname) 4. read the number of directory lines readdir ($ handle) 5. close the directory resource closedir ($ ha
1. Summary of common PHP functions (recommended)
Introduction: differences between fwrite and file_put_contents in PHP
7. when file_put_contents encounters a File exclusive lock, will the queue wait?
Introduction: file_put_contents('test.txt ', $ data, FILE_APPEND | LOCK_EX). the preceding statement takes a long time to write a large amount of data to a file, the subsequent file_put_contents will also write data to the file. because the file has an exclusive lock, the subsequent file_put...
8. how does php perform file io every KB?
Introduction: there is a log analysis program, including file reading and writing, file_put_contents, fgets, and the database load data local infile, which is loaded into the database from the file, how to write a database when the file size reaches KB
9. I used file_put_contents to upload an image, but it can only be saved in the current directory. how can I move the image to the desired directory?
Introduction: {code ...} I uploaded the image after converting it to Base64, but the file_put_contents function can only be used to store it in the directory of the script. how can I move the uploaded image to the desired directory?
10. I used file_put_contents to upload an image, but it can only be saved in the current directory. how can I move the image to the desired directory?
Introduction: {code ...} I uploaded the image after converting it to Base64, but the file_put_contents function can only be used to store it in the directory of the script. how can I move the uploaded image to the desired directory?
[Related Q & A recommendations ]:
Saving format of PHP program running error log information
Php-about how to deploy code using webhook on github?
Crontab scheduled execution of php file_put_contents cannot be created and written to a file, but self-execution can be successful.
When php-file_put_contents contains the & symbol, how can this problem be solved?
Ucenter-php file_put_contents is a strange problem
The above is a detailed article about the php file_put_contents () function. we recommend 10 articles. For more information, see other related articles in the first PHP community!