Php 表情符号编码不正确
我正在构建一个Facebook messenger机器人,我正在尝试显示一个类似这样的表情符号Php 表情符号编码不正确,php,json,facebook,Php,Json,Facebook,我正在构建一个Facebook messenger机器人,我正在尝试显示一个类似这样的表情符号 $data =json_encode([ 'speech' => "\xF0\x9F\x98\x84", 'displayText' => "test", 'source' => "source" ]); $output = json_decode($data); echo ' '.$output->speech; 这适用于我的本地脚本,但当我尝试在Facebook me
$data =json_encode([
'speech' => "\xF0\x9F\x98\x84",
'displayText' => "test",
'source' => "source"
]);
$output = json_decode($data);
echo ' '.$output->speech;
这适用于我的本地脚本,但当我尝试在Facebook messenger上显示表情符号时,会出现以下错误:
“使用表情符号短格式查找值开头的字符“ð”无效。其中包含将在facebook messenger平台和facebook网站上使用的短格式列表。”
$data =json_encode([
'speech' => ">:(",
'displayText' => "test",
'source' => "source"
]);
$output = json_decode($data);
echo ' '.$output->speech;
然而,发送表情符号的unicode或十六进制表示法似乎不起作用。您尝试过特殊的html字符吗?请发布用于显示“表情符号”的代码,如果它对您有效,请接受我的答案