Master brother, come fast, urgent... How can I replace the specified character nihao in c: \ a.txt with haha by using JS commands and keep it as a new file c: \ B .txt which indicates that c: \ a.txt contains a lot of messy code, but there is only one nihao character ------ solution ------------------ PHPcode $ contentsfile_get_contents master brother, come fast, urgent...
How can I replace the specified character nihao in c: \ a.txt with haha with a new file c: \ B .txt with a JS command?
Note: c: \ a.txt contains a lot of messy code, but only one nihao character
------ Solution --------------------
PHP code
$ Contents = file_get_contents ("c: \ a.txt"); if (! $ Contents) exit ("check whether the file path is correct"); $ new_contents = str_replace ("nihao", "haha", $ contents); file_put_contents ("c: \ B .txt ", $ new_contents );