strip_tags and htmlentities

前端 未结 4 1393
一个人的身影
一个人的身影 2020-12-05 08:49

Should I use htmlentities with strip_tags?

I am currently using strip_tags when adding to database and thinking about removing

4条回答
  •  鱼传尺愫
    2020-12-05 09:12

    I wouldn't use htmlentities as this will allow you to insert the string, as is, into the database. Yhis is no good for account details or forums.

    Use mysql_real_escape_string for inserting data into the database, and strip_tags for receiving data from the database and echoing out to the screen.

提交回复
热议问题