Sorry if this has been answered before somewhere... but it's a pain to actually search for it because of the character output.
Whenever I write to a text file using fwrite... instead of writing a single quotation mark... I get a backslash before every one. thusly:
<a href="http://www.targetwebsite" target="_blank">
Looks like
<a href=\"http://www.targetwebsite\" target=\"_blank\">
Huh?
I am using nl2br since I want people not to have to use html... but have it as an option. Am I doing something wrong... or do I need to find an replace all of these characters with a script?
It's a pain in the ass trying to search for \" as a problem in any search engine.
Any help would be much obliged.
pants
Newbie fwrite text file question
Moderator: General Moderators
strip
Did you try?
Code: Select all
<?php
stripslashes($string);
?>Maybe
The slashes are created by "magic slashes" a feature that is on by default and defined in your php.ini file. It adds slashes and removes slashes when pulling to and from databases. I just leave mine on and deal with it. If you're on a shared server you are probably stuck with it. There is a lot more you can read about it on the forum. Do a search for "magic slashes." I think the general opnion in this forum is that it's best to addslashes() and stripslashes() in your code rather than allowing "magic slashes" to do it for you.