Forum Moderators: coopster

Message Too Old, No Replies

Replace string contain quote changed to \"

replace string

         

irw10062

5:33 pm on Aug 15, 2010 (gmt 0)

10+ Year Member



hello master,
i use this to replace html file

$file_str = file_get_contents($filename);
$file_str = str_ireplace($search_string, $replace_string, $file_str);


$replace_string send via POST, contain like this :
window.onload = loadjscssfile("http://www.#*$!x/#*$!.php", "js")


on localhost and another server, result is right, same as i posted,

but on another server, the result different, i open the replaced file, the result become like this :

window.onload = loadjscssfile(\"http://www.#*$!x/#*$!.php\", \"js\")


the --> " changed to --> \"
so where is wrong, php config ?

Readie

8:22 pm on Aug 15, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's just escaping things that might cause the operation to go a bit wrong. Run the output through stripslashes() to clear this up.

irw10062

4:19 am on Aug 16, 2010 (gmt 0)

10+ Year Member



okay,
i tested, it's work

thanks