Home  >  Q&A  >  body text

php - emoji display problem in web

php stores emoji expressions in WeChat. Before storing in the database, I printed it on the page and the expressions can be displayed normally. Then after storing them in the database (utf8mb4), the expressions can also be displayed normally in the database. But what happens when PHP reads the expressions in the database and displays them on the page? .
Why is this? Does it still need to be transcoded or something?

迷茫迷茫2694 days ago806

reply all(2)I'll reply

  • 滿天的星座

    滿天的星座2017-06-27 09:20:11

    emoji is an expression picture, but when it is saved to the database, it is the encoding corresponding to the saved picture. After you take it out, you still have to find the corresponding picture with the code!

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-06-27 09:20:11

    As you said in the last sentence, it needs to be converted (but not HTML transcoding). Emoji is an emoticon and needs a map to associate it.
    That is, encoding -> picture

    For details, you can look at this open source project. It has everything I said, and it belongs to a specific example:

    https://github.com/iamcal/php-emoji

    reply
    0
  • Cancelreply