如何在php留言板中添加表情?

如何在php留言板中添加表情?,第1张

举个例子<input type="radio" name="face" value="gx"/>高兴(表情图片)

<input type="radio" name="face" value="fn"/>愤怒(表情图片)

<input type="radio" name="face" value="dx"/>大笑(表情图片)

<input type="radio" name="face" value="wl"/>高兴(表情图片)

把value存进数据库就行!

然后读取的时候<?php echo "<img src=\"$face\."\.gif"\">"?>

首先要在网上下载到FCKeditor解压包,解压后去掉不相关的文件,如ASP等,可以压缩文件大小。将FCKeditor目录放在网站根目录.

在配置文件fckconfig.js中,将

FCKConfig.ToolbarSets["Default"] = [

['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],

['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],

['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],

['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],

'/',

['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],

['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],

['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],

['Link','Unlink','Anchor'],

['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],

'/',

['Style','FontFormat','FontName','FontSize'],

['TextColor','BGColor'],

['FitWindow','ShowBlocks','-','About'] // No comma for the last row.

]

改为

FCKConfig.ToolbarSets["Default"] = ['Smiley']

只保留表情功能,然后建立调试页面test.php调用编辑器:

<?php

//包含fckeditor类

include("/fckeditor/fckeditor.php")

//创建一个FCKeditor,表单名称为 jzleditor

$oFCKeditor = new FCKeditor("jzleditor")

//设置编辑器路径

$oFCKeditor->BasePath = "/fckeditor/"

$oFCKeditor->ToolbarSet = "Default"//工具按钮

$oFCKeditor->Value =$cont //设置初始内容

$oFCKeditor->Width="100%" //设置它的宽度

$oFCKeditor->Height="550px" //设置它的高度

$oFCKeditor->Create()

?>

用软银版的emoji,如雪人的小图标,“\ue048”\x0d\x0a\x0d\x0a公众号PHP编写的接口文件,回复“\ue048”是不行的。需要转码,\x0d\x0a\x0d\x0a//content\x0d\x0aunicode2utf8("\ue02d")\x0d\x0a\x0d\x0a//转码函数\x0d\x0afunctionunicode2utf8($str){//unicode编码转化,用于显示emoji表情\x0d\x0a$str='{"result_str":"'.$str.'"}'//组合成json格式\x0d\x0a$strarray=json_decode($str,true)//json转换为数组,利用JSON对\uXXXX的支持来把转义符恢复为Unicode字符\x0d\x0areturn$strarray['result_str']\x0d\x0a}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/7988502.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-12
下一篇 2023-04-12

发表评论

登录后才能评论

评论列表(0条)

保存