Home >Backend Development >PHP Tutorial >Chat room technology -- implementation of stickers_PHP tutorial
If you can add some beautiful pictures to the chat text...
The generation of image codes is the same as expressions and actions. You can select from the menu or input manually. Only the format
and code are given here. No explanation will be given. Please check the expressions and actions section
1 File format
//$picturefilename
1$split brown suit$splitxw20151.jpg$split
2$split black tuxedo$splitxw201534.jpg$split
Number + name + picture name +
2 Programs
My chat room uses the ///gift+number method to display pictures. Note the three backslashes, which is different from the emoticon
action
//Determine whether the first 7 characters of the speech content are///gift
if(substr($message,0,7) == "/// gift")
{
//Get the number of the picture, 2 characters starting from the 7th character (note that characters are numbered starting from 0)
$id = substr($message,7,2)-1;
//Read the picture file
$giftmsg = file($picturefilename);
//Determine whether the number is legal
if(($id >= 0) && ($id < count($giftmsg)) )
{
//Split the picture row
$gift=split($split,$giftmsg[$id],99);
//Generate the speech content of the picture
$message ="or=$namecolor>$name< /font>Giveo) target=d>$talktoa $gift[1]0 height=60 border=0>";
//Picture generation success sign
$specialsign = 1;
}
}
It’s very simple, isn’t it? Why not try it yourself!!