This question has already been answered:
In the php script, the post method passes a json-like object: {"name":"Иван", "surname":"Иванов"} . Next, you need to write this object to a plain text file. When trying to implement it like this:
file_put_contents($file, json_encode($obj), FILE_APPEND); Similar text is entered into the file instead of Cyrillic:
\ u0418 \ u0432 \ u0430
Solving this problem turned out absolutely inelegant way:
$file = "file.txt"; $str = '{'; foreach($obj as $key=>$val) { $str.='"'.$key.'":'.'"'.$val.'",'; } $str = preg_replace("/.$/","",$str); $str .= "}\n"; file_put_contents($file, $str, FILE_APPEND); The object must be written to the file with curly brackets. All files are UTF8 encoded without BOM. Tell me please, maybe there is some more beautiful and concise way to cope with this task?