File with utf8 encoding, create variable
$str = 'ааыв'; file_put_contents('ile.txt', $str , FILE_APPEND); And writes the following to the file:
ааыв How to write to the file that the Russian characters were? ..
mb_detect_encoding($str );// UTF-8 Via echo, it displays the string correctly, in Russian characters on the page.