Recommended 10 articles for PHP file_put_contents () functions

Source: Internet
Author: User
One, write the file 1. Open a resource (file) fopen ($filename, $mode) 2. Write File fwrite ($handle, $STR) 3. Close File Fclose ($handle) 4. One-Step write File_put_contents ($ FileName, $str, $mode) file_append LOCK_EX} Second, read the file 1. read file fread ($handle, bytes) 2. Read a line of fgets ($handle); 3. read one character fgetc ($handle) 4. Read into an array of file ($filename) 5. One-step read file_get_contents ($filename) Three, directory operation 1, build directory mkdir ($dirname) 2, delete directory rmdir ($dirname) 3, open the directory handle Opendir ($dirname) 4, read the directory number Readdir ($handle) 5, close the directory resource Closedir ($ha

1. Summary of common functions of PHP (recommended)

Introduction: Write a file 1. Open a resource (file) fopen ($filename, $mode) 2. Write File fwrite ($handle, $STR) 3. Close File Fclose ($handle) 4. One-Step write file_put_contents ($filename, $str, $mode) File_ ...

2. How to implement file_put_contents append and line break in PHP?

Introduction: The following small series for everyone to bring a PHP file_put_contents append and line break implementation method. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.

3. PHP simple implementation method to generate TXT file to the specified directory

Introduction: This article mainly introduces the simple implementation of PHP to generate TXT files to the specified directory method, a simple comparison of PHP fwrite and file_put_contents functions such as the use of methods, the need for friends can refer to the following

4. After the PHP associative array is sorted, output to the front end with Json_encode, why is the order changed?

Summary: After the PHP associative array is sorted, output to the front end with Json_encode, why is the order changed? This is a sorted array written to the file using the File_put_contents function, which is the right order. This is the data from the Echo json_encode () output to the foreground, and the order has changed. Why ...?

5. PHP fwrite writing to file succeeds but no content

Introduction: Found a very strange problem, I write files with fwrite, the program did not error, Fwrite also returned the number of words written, but the contents of the file is empty. {Code ...} The Yii2.0 framework is used. Try again with file_put_contents, as no response o__o "...

6. The difference between fwrite and file_put_contents in PHP

Introduction: The difference between fwrite and file_put_contents in PHP

7. file_put_contents meet file exclusive lock is queue waiting

Introduction: File_put_contents (' Test.txt ', $data, file_append| LOCK_EX), such as the above statement, if the large data volume of the file write operation, will take a long time, the subsequent file_put_contents also to the file to write data, because the file has an exclusive lock, the subsequent file_put ...

8. How PHP is file io per 200kb

Introduction: Here is a log analysis program, which has the file read and write, File_put_contents,fgets, as well as the database load data local infile, from the file loading database, how to do the file size reached 200kb for a database write

9. I upload images with file_put_contents, but only in the current directory, how to move the picture to the desired directory?

Introduction: {Code ...} I am the picture converted to Base64 after uploading, but with the file_put_contents function can only be placed in the directory of the script, how can I move the uploaded images to the desired directory?

10. I upload images with file_put_contents, but only in the current directory, how to move the picture to the desired directory?

Introduction: {Code ...} I am the picture converted to Base64 after uploading, but with the file_put_contents function can only be placed in the directory of the script, how can I move the uploaded images to the desired directory?

"Related question and answer recommendation":

PHP Program run error log information save format problem

PHP-Questions about GitHub using Webhook to deploy code?

Crontab timed execution PHP file_put_contents cannot be created and written to a file but execution can be successful.

Php-file_put_contents contains the & symbol when execution fails how to break?

ucenter-php file_put_contents a strange question.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.