On the public platform, developers can send emojis to users. For example, QQ expressions and symbolic expressions. Qq expressions are easy to send. Although QQ expressions are displayed as emojis, they are text messages on the public platform. Each expression has a unique code corresponding to it. For example, if the first expression is "Smile", there are three types of expressions: smile; [Smile];:)
On the public platform, developers can send emojis to users. For example, QQ expressions and symbolic expressions. Qq expressions are easy to send. Although QQ expressions are displayed as emojis, they are text messages on the public platform. Each expression has a unique code corresponding to it. For example, the first expression "Smile" has three Representation Methods:/smile; [Smile];/: :)
On the public platform, developers can send emojis to users. For example, QQ expressions and symbolic expressions. Qq expressions are easy to send. Although QQ expressions are displayed as emojis, they are text messages on the public platform. Each expression has a unique code corresponding to it. For example, the first expression "Smile" has three Representation Methods:/smile; [Smile];/: :), you can directly send a QQ expression to the user by passing such a parameter to the contentStr of the message interface. The method in this example is very simple and I will not repeat it here.
Here, I mainly want to explain how to send symbolic expressions to users in the php environment.
The essence of a symbolic expression is also a text message. However, unlike the QQ expression, it is unicode encoded. If it is directly sent, it will be output as is. Developers need to encode and convert it. See the Code:
Public function emoji ($ emoji_str) {// combines strings into json format $ emoji_str = '["'. $ emoji_str. '"]'; $ emoji_arr = json_decode ($ emoji_str, true); if (count ($ emoji_arr) = 1) return $ emoji_arr [0]; elsereturn null ;}
The json_decode method is provided in php5.0 and later versions. JSON is a data storage format. It is very popular. It is really like an array. For more details, please refer to the relevant materials. We first convert the string to the array format, and then use the json_decode method. In this way, unicode encoding can be converted to UTF-8 encoding.
Call this function where you want to display a symbolic expression, for example:
$ ContentStr = "[muscle]". $ this-> emoji ($ emoji_str = "\ ue14c ");
For more emoticon code and implementation methods, see the following link:
Liu Feng's column
Emoji for PHP
For the bsdcfp column, please respect the hard work of others. Thank you!