php – 一个不需要的表情符号出现在通过webhook发送的Slack消息中
作者:互联网
我到处寻找其他人找到这个问题却找不到任何东西.
问题是我正在尝试使用Shopify订单号从php脚本向我的松弛通道发送消息.除了一件事之外,它正在起作用,它在消息中添加了一个红场表情符号,我无法弄清楚原因.
这是消息的来源:
red square that shouldn’t be there
这是我用来发送松弛消息的代码:
// Create a constant to store your Slack URL
define('SLACK_WEBHOOK', 'https://hooks.slack.com/services/x/x/eActr8MIhT0SIyKuGGwR0ScU');
// Make your message
$message = array('payload' => json_encode(array('text' => 'Order '.$shopify_order['name'].' has been sent to Embroidery Works' )));
// Use curl to send your message
$c = curl_init(SLACK_WEBHOOK);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $message);
curl_exec($c);
curl_close($c);
解决方法:
Worth nothing: #BA1242 is a dark-red color. You’ll often see it on programmer forums when describing CSS. color-hex.com/color/ba1242 – @Chris
Slack会自动发布十六进制颜色的预览(Chris!)!事实证明,这个特定的商店代码匹配十六进制颜色.
标签:php,curl,webhooks,slack-api,slack 来源: https://codeday.me/bug/20190622/1262147.html