Could you not remove the slashes before you write to the file?
Anyways to answer your question you should consult the manual for fopen, fread, fwrite functions in order to deal with reading and writing to the file.
To remove the slashes then you can use str_replace or strtr to find all of the occurences of backslashes and replace them with the empty string. If my memory serves me correctly you will need to use "\" in order to search for backslashes.