本文整理汇总了PHP中Subscriber::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscriber::findAll方法的具体用法?PHP Subscriber::findAll怎么用?PHP Subscriber::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber
的用法示例。
在下文中一共展示了Subscriber::findAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
$sub->send($msg);
}
echo json_encode($stock);
break;
case 'stocks':
$stocks = Stock::findAll();
echo json_encode($stocks);
break;
case 'delete':
$company = Request::any('company');
$stock = Stock::find($company);
$stock->delete();
echo json_encode($stock);
break;
case 'subscribers':
$subscribers = Subscriber::findAll();
echo json_encode($subscribers);
break;
case 'send':
$msg = Request::any('message');
$recs = Subscriber::findAll();
foreach ($recs as $r) {
SMS::send($r->phone, $msg);
}
echo json_encode(["success" => true]);
break;
}
} catch (Exception $e) {
http_response_code(500);
echo $e->getMessage();
}
示例2: while
<?php
require_once '../Lib.php';
while (true) {
echo "\n\nPreparing Broadcast...\n";
$stocks = Stock::findAll();
$recipients = Subscriber::findAll();
$msg = "==Stocks Update==\n";
foreach ($stocks as $stock) {
$msg .= $stock->company . ":" . $stock->price . "\n";
}
echo "Message is:\n{$msg}\n";
foreach ($recipients as $r) {
SMS::send($r->phone, $msg);
echo "Sent to {$r->phone}\n";
}
echo "Send Complete. About to sleep...\n";
echo "Sleeping...";
//wait for 60
sleep(30);
}