gpt4 book ai didi

Twilio,发送下一条消息之前暂停

转载 作者:行者123 更新时间:2023-12-02 07:09:57 35 4
gpt4 key购买 nike

我用这种方式发送消息:

$AccountSid = $options['twilio_sid'];
$AuthToken = $options['twilio_auth'];
$client = new Services_Twilio($AccountSid, $AuthToken);
$from = $options['twilio_number'];

foreach ($mesages as $message) {

$client->account->sms_messages->create(
$from,
$message['sms_notification'],
$author_notification
);
}

如何将其暂停几秒钟?

所有消息都应立即发送,但从脚本运行时起会延迟几秒。

我是否必须做出这样的改变:http://twilio-php.readthedocs.org/en/latest/usage/twiml.html#pause ?如果是,我如何让它在我的循环中工作?

最佳答案

这里是 Twilio 员工。

有一种更简单的方法可以完成您想做的事情,只需添加 <Pause> 在你的循环中像这样:

foreach ($mesages as $message) {


$client->account->sms_messages->create(
$from,
$message['sms_notification'],
$author_notification
);

//Add your pause here using sleep()
sleep(30);

}

这样你就可以自己控制延迟/ sleep !

关于Twilio,发送下一条消息之前暂停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24039581/

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