how to insert special character in mysql via php and display on html page

后端 未结 4 1169
半阙折子戏
半阙折子戏 2020-12-17 06:17

how to insert special characters into a database(MySQL) like

Registered symbol ( ® ) OR Copyright sign ( © ) OR Trade Mark sign ( ™ )<

4条回答
  •  無奈伤痛
    2020-12-17 06:43

    From the PHP docs for htmlentities():

    This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

    Don't worry about encoding things when you store them: store the data raw, and then encode it with htmlentities() when you display it in your HTML.

    Edit: Also, read this.

提交回复
热议问题