Command: file_put_contents();
Command analysis: file_put_contents (PHP 5)
file_put_contents -- Write a string to a file
Instructions:
int file_put_contents ( string filename, string data [, int flags [, resource context]] )
has the same function as calling fopen(), fwrite() and fclose() in sequence.
The data parameter can be an array (but not a multi-dimensional array), which is equivalent to file_put_contents($filename, join('', $array))
Since PHP 5.1.0, the data parameter can also be specified For stream resources, the cache data saved in the stream will be written to the specified file. This usage is similar to using the stream_copy_to_stream() function.
Parameters
filename
The name of the file to which data will be written.
data
Data to be written. The type can be string, array or stream resource (as mentioned above).
flags
flags can be FILE_USE_INCLUDE_PATH, FILE_APPEND and/or LOCK_EX (to obtain an exclusive lock), however use FILE_USE_INCLUDE_PATH with extreme caution.
context
A context resource.
Write the code (the code itself is correct, but it learned another function by mistake):