gpt4 book ai didi

php - 将字符串限制为 256 个字节

转载 作者:行者123 更新时间:2023-11-28 19:18:13 24 4
gpt4 key购买 nike

我目前有:

$payload = array();
$payload['aps']['badge'] = 1;
$payload['aps']['alert'] = html_entity_decode($title);
$payload['aps']['sound'] = "default";

但是:

The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.

$title(主要是英文,特殊字符不多)通常大于 256 个字符。我应该如何检查和限制/删除多余的字符? strlen

最佳答案

如果标题大于 256,您可以使用 strlen 检查,或者直接将其剪切。$title = substr($title, 0, 256);

关于php - 将字符串限制为 256 个字节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10969034/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com