Home >headlines >File_put_contents function introduction and detailed explanation of usage

File_put_contents function introduction and detailed explanation of usage

不言
不言Original
2018-05-09 15:06:4410814browse

This time I will show you how to use the file_put_contents function in PHP. What are the precautions for using the file_put_contents function in PHP? The following is a practical case, let's take a look. Recently, I encountered a file upload question on EIS and found that filtering < basically made many gestures invalid. I thought about it for a long time but didn’t solve this question. After the game, I found out that I could use an array to bypass it. I analyzed it here. Not much to say about the principle, let’s take a look at the detailed introduction. Let’s take a look at the official website definition of the second parameter data of the file_put_contents function: data The data to be written. The type can be string, array or stream resource (as mentioned above). ​ If data is specified as a stream resource, the cached data saved in the stream will be written to the specified file. This usage is similar to

1. How to use file_put_contents in PHP Function

File_put_contents function introduction and detailed explanation of usage

Introduction: The file_put_contents() function writes a string to a file. Recently, I discovered that the file_put_contents function has problems that I have never noticed, so the following article mainly introduces you to the relevant information about the dangerous file_put_contents function in PHP. Friends who need it can refer to it. Let’s take a look together.

2. Detailed explanation of file_put_contents function in PHP

File_put_contents function introduction and detailed explanation of usage

Introduction: This article mainly shares with you the detailed explanation of the file_put_contents function in PHP. I recently encountered a file upload question on EIS and found that filtering < basically made many gestures invalid. I have been thinking about it for a long time and haven’t figured it out yet. After the game, I found out that I could use an array to get around it. The principle is analyzed here. Without further ado, let’s take a look at the detailed introduction.

3. Detailed explanation of the dangerous file_put_contents function in PHP

Introduction: file_put_contents() function writes a string into the file. Recently, I discovered that the file_put_contents function has problems that I have never noticed, so the following article mainly introduces you to the relevant information about the dangerous file_put_contents function in PHP. Friends who need it can refer to it. Let’s take a look together.

4. php file_get_contents() function and file_put_contents() function usage instructions

Introduction: file_get_contents - put the entire The file reads a string; the file_put_contents() function writes a string to the file.

5. 10 recommended articles about the php file_put_contents() function

File_put_contents function introduction and detailed explanation of usage

Introduction: 1. Write a file 1. Open the resource (file) fopen($filename,$mode) 2. Write the file fwrite($handle,$str) 3. Close the file fclose($handle )4. Write file_put_contents($filename,$str,$mode) in one step FILE_APPEND LOCK_EX} 2. Read the file 1. Read the file fread($handle, number of bytes) 2. Read a line of fgets($hand...

6. How to append and wrap file_put_contents in php?

File_put_contents function introduction and detailed explanation of usage

#Introduction: The editor below will bring you an implementation method of file_put_contents appending and line wrapping in PHP. I think it is quite good, so I will share it with you now and give it a reference. Let the editor come and take a look

7. The difference between fwrite and file_put_contents in PHP

File_put_contents function introduction and detailed explanation of usage

Introduction: The difference between fwrite and file_put_contents in PHP

8. file_put_contents will wait in queue when encountering a file exclusive lock

Introduction: file_put_contents('test.txt',$data,FILE_APPEND |LOCK_EX);For the above statement, if a large amount of data is being written to a file, it will take a long time. The subsequent file_put_contents will also write data to the file. Since the file has an exclusive lock, subsequent file_put...

9. I use file_put_contents to upload pictures, but they can only be saved in the current directory. How can I move the picture to the desired directory?

Introduction: {code...} I converted the image to Base64 and then uploaded it, but using the file_put_contents function can only be placed in the directory of the script. How can I upload it? How to move the uploaded pictures to the desired directory?

10. I use file_put_contents to upload pictures, but they can only be saved in the current directory. How can I move the picture to the desired directory?

Introduction: {code...} I converted the image to Base64 and then uploaded it, but using the file_put_contents function can only be placed in the directory of the script. How can I upload it? How to move the uploaded pictures to the desired directory?

11. Using the ob function and file_put_contents in php to generate a simple static page class

Introduction::This article The article mainly introduces the class that uses the ob function and file_put_contents in PHP to generate simple static pages. Students who are interested in PHP tutorials can refer to it.

12. ucenter - php file_put_contents A strange question

Introduction: The company project requires the use of ucenter, local I installed one independently on my computer. After installing dz, I found that the communication failed in ucenter. I checked step by step that the data/cache/apps.php cache in ucenter was not updated, causing the communication failure. After deleting apps.php, the communication was successful. Update apps.php in ucenter slowly...

13. Code to create empty files in PHP [file_put_contents vs touch]

Introduction:: Code to create an empty file in PHP [file_put_contents vs touch]: I has passed a small test to check which function is faster to create a new file. file_put_contents vs touch Copy the code as follows:

14. php file_put_contents function function (integrated fopen, fwrite, fclose)

Introduction:: php file_put_contents function function (integrated fopen, fwrite, fclose): Command: file_put_contents(); Command analysis: file_put_contents (PHP 5) file_put_contents -- Write a string to the file Description: int file_put_contents ( string filename, string data [, int flags [, resource context]] ) and call fopen(), fwr in sequence

15. PHP download file_put_contents vs readfile

Introduction:: PHP download file_put_contents vs readfile: set_time_limit(0);ini_set( 'memory_limit', '512M');//Get the current time function getTime($convert = true){ return microtime($convert);}//Get the current memory function memory(){ return memory_get_usage();}$m = memory();$s =

16. file_put_contents Picture saving function returns the value after success

Introduction:: file_put_contents picture saving function returns value after success: When saving pictures today, I used file_put_contents() to save pictures. I ran it several times, but no data came out. I thought this function did not operate successfully, so I checked the function. Usage and return value, I found that the returns I output were correct. Later I found out that it was caused by other reasons. Now I will share the usage of this function: file_put_contents() function is the most suitable choice for writing strings or appending string contents to the file at one time. . The file_put_contents() function is used to write strings

17. file_put_contents High concurrency and exclusive locking issues

Introduction: file_put_contents High concurrency and exclusive locking issues

18. php file_put_contents() function (integrated fopen, fwrite, fclose)_PHP tutorial

Introduction: php file_put_contents() function Function (integrated fopen, fwrite, fclose). Command: file_put_contents(); Command analysis: file_put_contents (PHP 5) file_put_contents -- Write a string to the file description: int file_put_contents ( string filename, s

19. Code to create an empty file in PHP [file_put_contents vs touch]_PHP tutorial

Introduction: Code to create an empty file in PHP [file_put_contents vs touch] I have passed a small test. to check which function is faster to create a new file. file_put_contents vs touch Copy code The code is as follows: ?php for($i = ; $i 100; $i ) { file_put_cont

##20 . Fwrite and file_put_contents performance test code in PHP_PHP tutorial

##Introduction: fwrite and file_put_contents performance test code in PHP function microtimeFloat() { list($usec). ,$sec) = explode(" ", microtime()); return((float)$usec (float)$sec); } 1. Test file_put_contents Copy the code as follows: ?php $userCount

21.

php file_put_contents function_PHP tutorial##Introduction: php file_put_contents function. php file_put_contents function file_put_contents (PHP 5) file_put_contents - write a String to a file description international file_put_contents (string $ file name, mixed $ data

22.

PHP file_put_contents() implements batch download of image files and image code in css_ PHP tutorial

#Introduction: PHP file_put_contents() implements batch downloading of image files and image codes in css. Let’s first introduce the methods of batch downloading image files and images in css in php. We will use the file_put_contents() function for this. Let’s look at the first batch download of images

23.

PHP file_put_contents Write or append a string to a file_PHP tutorial

Introduction: PHP file_put_contents Write or append a string to a file. In php, the file file_put_contents function can write our string into a file. This is a bit the same as the php fwrite file. Let's take a look at the usage of file_put_contents and

24.

file_put_contents Error: failed to open stream: Invalid argument One reason, invalidromcontents_PHP tutorial

Introduction: file_put_contents Error: failed to open stream: Invalid argument One reason Reason, invalidromcontents. file_put_contents error: failed to open stream: Invalid argument One reason, invalidromcontents When testing the nilcms system today, an error occurred, causing the cache to be unable to be updated

25.

file_put_contents () Image saving function returns value after success

##Introduction: file_put_contents() Image saving function returns value after success

[Related Q&A Recommendation]:

php fwrite successfully writes the file but the file has no content

##javascript - json data format

What to do if writing fails

PHP append problem when operating a two-dimensional array subarray in a JSON file

php - is_file($userPath) || file_put_contents($xx,$xx) What does it mean

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP pathinfo functionNext article:PHP pathinfo function