In PHP when submitting strings to the database should I take care of illegal characters using htmlspecialchars() or use a regular expression?

前端 未结 6 2032
说谎
说谎 2020-11-22 03:18

I am working on a form with the possiblity for the user to use illegal/special characters in the string that is to be submitted to the database. I want to escape/negate thes

6条回答
  •  猫巷女王i
    2020-11-22 03:55

    This is not a problem you want to tackle on your own. There are libraries out there to do this for you, such as the HTML Purifier.

提交回复
热议问题