Bitrix Site Manager

RewriteFile

bool
RewriteFile(
 string abs_path,
 string content
)

The function RewriteFile writes a new content to file. Returns true on success, or false otherwise.

Parameters

ParameterDescription
abs_path Absolute path to file which is to be overwritten.
content New content of the file.

See Also

Example



<?
// overwrite file /en/index.php
$content = '
    <?
    require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
    $APPLICATION->SetTitle("Page header");
    ?>
    <?
    require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
    ?>
';
RewriteFile($_SERVER["DOCUMENT_ROOT"]."/en/index.php", $content);
?>