我想将表情符号 😀
转换为 html 😀
并在我的网站上显示 html 代码而不是表情符号,我使用 htmlentities("😀") ;
但根本不工作。如何在我的网站中将表情符号显示为 html 代码或进行转换?
最佳答案
$utf32 = mb_convert_encoding( "😀", 'UTF-32', 'UTF-8' );
$hex4 = bin2hex($utf32);
$dec = hexdec($hex4);
echo "&#$dec;"; // 😀
echo "&#$dec;"; // 😀
关于php - 将表情符号转换为 html 代码或将表情符号显示为 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37773232/