如何在我的PHP脚本中添加暂停?
我有邮件发送脚本(使用PHP)。此脚本可能会发送太多电子邮件。。。。现在我需要这个脚本的限制。限制:当我们想要发送1000封电子邮件时,发送100封电子邮件后的脚本将休眠60秒。此伪代码解释:如何在我的PHP脚本中添加暂停?,php,email,Php,Email,我有邮件发送脚本(使用PHP)。此脚本可能会发送太多电子邮件。。。。现在我需要这个脚本的限制。限制:当我们想要发送1000封电子邮件时,发送100封电子邮件后的脚本将休眠60秒。此伪代码解释: send 100 mails .... send ok. sleep 60s.(stop sending for 60s) send other 100 mails (100-200)... send ok. sleep 60s. (stop sending for 60s) send other 100
send 100 mails ....
send ok.
sleep 60s.(stop sending for 60s)
send other 100 mails (100-200)...
send ok.
sleep 60s. (stop sending for 60s)
send other 100 mails (200-300)...
现在此脚本有两个限制:
$max_chars = 20000;
$max_sends = 100000;
但我还需要两个限制:
$sleep_time = 60s;
$sleep_after_send = 100;
你能帮我在这个脚本上加上这两个新的限制并编写类吗?你可以使用php睡眠函数
for($i = 1 ;$i <= $max_sends ; $i++)
{
// send email here and check status
if($i % 100 == 0)
sleep(60);
}
for($i=1;$i嗯……不?我们不是来帮你做事情的。我们是来帮你解决编程问题的。如果你想让别人帮你做这件事,我建议你找个程序员并付钱给他们。小结:你可以用100
交换$sleep\u-after\u-send
值,也可以用60
交换$sleep\u-time
。