UK['kɒntents] US['kɒntents]
n. Content; content; (book, speech, program, etc.) theme; content (plural noun of content); (book, etc.) (of) content, directory; capacity, content; (of books, speeches, programs, etc.) topic
Third person singular: contents Plural: contents Present participle: contenting Past tense: contented Past participle: contented
php file_put_contents() function syntax
Function: Write a string into the file.
Syntax: file_put_contents(file,data,mode,context)
Parameters:
Parameter | Description |
file | Required. Specifies the file to which data is to be written. If the file does not exist, a new file is created. |
data | Optional. Specifies the data to be written to the file. Can be a string, array, or data stream. |
mode | Optional. Specifies how to open/write the file. Possible values: FILE_USE_INCLUDE_PATH, FILE_APPEND, LOCK_EX. |
context | Optional. Specifies the environment for a file handle. context is a set of options that can modify the behavior of the stream. If null is used, it is ignored. |
Description: This function will return the number of bytes of data written to the file.
php file_put_contents() function example
<?php echo file_put_contents("./test.txt","Hello php. I'm study in php.cn!"); ?>