2016-06-12 78 views
2

我想將表情符號轉換爲html 😀,並在我的網站中顯示html代碼不是表情符號,我使用htmlentities("");,但根本不工作。如何在我的網站上顯示錶情符號爲html代碼或將其轉換?將表情符號轉換爲html代碼或將html顯示爲表情符號

+0

類似於'😀'? –

+0

是的,我想要顯示它,但我的網站是顯示錶情符號,而不是代碼.. –

+0

請參閱http://stackoverflow.com/questions/34956163/htmlentites-not-working-for-emoji – Curtis

回答

3

值得嗎?

$utf32 = mb_convert_encoding("", 'UTF-32', 'UTF-8'); 
$hex4 = bin2hex($utf32); 
$dec = hexdec($hex4); 
echo "&#$dec;";  // 
echo "&#$dec;"; // 😀