file_put_contents is adding backslashes to the code

后端 未结 2 1644
一个人的身影
一个人的身影 2021-01-22 12:34

I use file_get_contents() & file_put_contents() to load and save a .css file. After saving the loaded file the file_put_content

相关标签:
2条回答
  • 2021-01-22 12:50

    Stripslashes is probably what you're looking for. Certain PHP installations will automagically escape strings for you by adding slashes. This should reverse that.

    Check out Magic Quotes

    0 讨论(0)
  • 2021-01-22 13:00

    Most likely you have Magic Quotes turned on.

    So just turn it off in php.ini and restart PHP.


    To strip the slashes:

    file_put_contents($file, stripslashes($_POST['editor']));
    
    0 讨论(0)
提交回复
热议问题