Documentation

putFileContents

resource public
\Bitrix\Main\IO\File::putFileContents(
 string $path,
 $data,
 $flags = self::REWRITE
);

Static method writes data into file. When flag is specified, the data will be written at the end. Otherwise, file will be rewritten fully. When no file exists, it will be created. When creating the file, not only the file is created, but also all directories within its path.

Similar to the method in the old core: RewriteFile.

Parameters

ParameterDescriptionVersion
$pathFull path to file
$dataData for writing
$flagsflag

Example



© «Bitrix24», 2001-2024
Up