當前位置:首頁 » 編程語言 » php表情符號

php表情符號

發布時間: 2022-07-03 05:19:44

❶ 如何用php匹配並替換iOS標準的emoji表情符號

用PHP匹配並替換iOS標準的emoji表情符號
preg_match('/\x{d83d}\x{de04}/u', $str_with_smail_emotion, $matches);

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

舉個例子<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"\">";?>

❸ PHP中關於表情符號的問題~~

<?php
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the integration file for PHP 5.
*
* It defines the FCKeditor class that can be used to create editor
* instances in PHP pages on server side.
*/

class FCKeditor
{
var $InstanceName ;
var $BasePath ;
var $Width ;
var $Height ;
var $ToolbarSet ;
var $Value ;
var $Config ;

// PHP 5 Constructor (by Marcus Bointon <[email protected]>)
function __construct( $instanceName )
{
$this->InstanceName = $instanceName ;
$this->BasePath = '/fckeditor/' ;
$this->Width = '540' ;
$this->Height = '220' ;
$this->ToolbarSet = 'Default' ;
$this->Value = '' ;

$this->Config = array() ;
}

function Create()
{
echo $this->CreateHtml() ;
}

function CreateHtml()
{
$HtmlValue = htmlspecialchars( $this->Value ) ;

$Html = '<div>' ;

if ( $this->IsCompatible() )
{
if ( isset( $_GET['fcksource'] ) && $_GET['fcksource'] == "true" )
$File = 'fckeditor.original.html' ;
else
$File = 'fckeditor.html' ;

$Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ;

if ( $this->ToolbarSet != '' )
$Link .= "&Toolbar={$this->ToolbarSet}" ;

// Render the linked hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ;

// Render the configurations hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />" ;

// Render the editor IFRAME.
$Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ;
}
else
{
if ( strpos( $this->Width, '%' ) === false )
$WidthCSS = $this->Width . 'px' ;
else
$WidthCSS = $this->Width ;

if ( strpos( $this->Height, '%' ) === false )
$HeightCSS = $this->Height . 'px' ;
else
$HeightCSS = $this->Height ;

$Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ;
}

$Html .= '</div>' ;

return $Html ;
}

function IsCompatible()
{
global $HTTP_USER_AGENT ;

if ( isset( $HTTP_USER_AGENT ) )
$sAgent = $HTTP_USER_AGENT ;
else
$sAgent = $_SERVER['HTTP_USER_AGENT'] ;

if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
{
$iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
return ($iVersion >= 5.5) ;
}
else if ( strpos($sAgent, 'Gecko/') !== false )
{
$iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
return ($iVersion >= 20030210) ;
}
else
return false ;
}

function GetConfigFieldString()
{
$sParams = '' ;
$bFirst = true ;

foreach ( $this->Config as $sKey => $sValue )
{
if ( $bFirst == false )
$sParams .= '&' ;
else
$bFirst = false ;

if ( $sValue === true )
$sParams .= $this->EncodeConfig( $sKey ) . '=true' ;
else if ( $sValue === false )
$sParams .= $this->EncodeConfig( $sKey ) . '=false' ;
else
$sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ;
}

return $sParams ;
}

function EncodeConfig( $valueToEncode )
{
$chars = array(
'&' => '%26',
'=' => '%3D',
'"' => '%22' ) ;

return strtr( $valueToEncode, $chars ) ;
}
}

?>

定義的一個類,專門顯示符號的,當然,符號已經在指定目錄中存好了

include('./fckeditor/fckeditor.php') ;
$sBasePath="./fckeditor/";
$oFCKeditor = new FCKeditor($face;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = @$a[$face];
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Width = '480';
$oFCKeditor->Height = '340';
$oFCKeditor->Create() ;
這是個調用方法

❹ 正在用php 做一個WEB 即時通訊,想問下表情符號這個問題怎麼解決!

你不用將圖片發送,你將圖片的名稱傳過去,然後客戶這邊用js調用相應的圖片不就好了嗎

❺ php 怎麼處理 emoji表情

1、使用utf8mb4字元集
如果你的mysql版本>=5.5.3,你大可直接將utf8直接升級為utf8mb4字元集
這種4位元組的utf8編碼可完美兼容舊的3位元組utf8字元集,並且可以直接存儲emoji表情,是最好的解決方案
至於位元組增大帶來的性能損耗,我看過一些評測,幾乎是可以忽略不計的
2、使用base64編碼
如果你因為某些原因無法使用utf8mb4的話,你還可以使用base64來曲線救國
使用例如base64_encode之類的函數編碼過後的emoji可以直接存儲在utf8位元組集的數據表中,取出時decode一下即可
3、幹掉emoji表情
emoji表情是個麻煩的東西,即使你能存儲,也不一定能完美顯示。在iOS以外的平台上,例如PC或者Android。如果你需要顯示emoji,就得准備一大堆emoji圖片並使用第三方前端類庫才行。即便如此,還是可能因為emoji圖片不夠全而出現無法顯示的情況在大多數業務場景下,emoji也不是非要不可的。我們可以適當地考慮幹掉它,節約各種成本
經過一番苦苦的google,終於找到靠譜能用的代碼:

❻ php怎麼顯示emoji表情符號

這個問題後盾人有,可以去後盾人看看,我一般都是在那邊學習.

❼ php留言板怎麼添加表情的代碼

好像類似html中的特殊字元,比如&nsbp是空格 ,需要你自己定義

❽ php 怎麼用正則表達式替換表情特殊符號 [em_27] 替換成表情

可以用preg_replace()函數
1preg_replace( mixed pattern, mixed replacement, mixed subject [, int limit ] )
大概的正則是
$pattern
=
'/\[em_(\d+)\]/'
具體的還要根據你的代碼來修改

❾ PHP怎麼處理移動端提交的表情字元

需設置 mysql 的字元集為 utf8mb4
在實行sql server 向 mysql 遷移數據時,報錯:
Incorrect string value: '\xF0\x9F\x98\x8A'
原因是mysql 採用的是 utf8 的字元集,而該字元集最多佔用三個位元組,而一些 表情 需要佔用 4個位元組,所以需要將 utf8 改成 utf8mb4。
原始配置為:
#mysql 5.5 新增參數
character_set_server=utf8
collation_server=utf8_bin
我將 character_set_server=utf8 改為:character_set_server=utf8mb4,重啟mysql 卻報錯:
發生系統錯誤 1067 進程意外終止
但是查看錯誤日誌,卻沒有顯示是什麼錯誤信息。有倒騰了一會兒,想到是不是 collation_server 也要修改成 utf8mb4_bin,測試的結果果然如此。
所以要注意在將 MySQL字元集 utf8 改為 utf8mb4 時,一定要注意 collation_server 也要同時修改!
乾脆將 default-character-set=utf8mb4 也改成了算了。
最後的字元配置如下:
[mysql]
default-character-set=utf8mb4
init_connect='set names utf8mb4'
[mysqld]
character_set_server=utf8mb4
collation_server=utf8mb4_bin
修改之後,啟動成功。

❿ 求php正則替換 表情符號轉換為圖片

<?php
$msg='{s:2}{s:123}{s:12}太好了';
$msg=preg_replace("/{s:([1-9]{1,2})}/i","<imgsrc='http://127.0.0.1/face/$1.gif'/>",$msg);
echo$msg;
?>

截圖:

熱點內容
副編譯 發布:2025-02-04 02:05:25 瀏覽:613
解壓按摩師 發布:2025-02-04 01:21:31 瀏覽:424
linuxssh限制 發布:2025-02-04 01:20:40 瀏覽:697
腳本式是什麼 發布:2025-02-04 01:06:24 瀏覽:248
手機wps密碼怎麼取消密碼 發布:2025-02-04 00:51:44 瀏覽:596
演算法邏輯表 發布:2025-02-04 00:51:44 瀏覽:241
零售股票如何配置主線 發布:2025-02-04 00:51:07 瀏覽:948
預演算法施行時間是 發布:2025-02-04 00:50:30 瀏覽:342
世界ol上傳照片 發布:2025-02-04 00:34:13 瀏覽:62
有初始化的數組編譯提示重復定義 發布:2025-02-04 00:33:21 瀏覽:584