How to store escaped characters in MySQL and display them in php?

前端 未结 3 551
感情败类
感情败类 2021-01-29 01:53

For example I want to store the String \"That\'s all\". MySQL automatically escapes the \' character. How do I echo that String from the database using php but remove the \\ in

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 02:15

    If you use prepared statements, those characters will not be escaped on insert.

    Use stripslashes() to remove slashes if you cannot avoid adding slashes on input.

提交回复
热议问题