本文整理汇总了PHP中Sms::receive方法的典型用法代码示例。如果您正苦于以下问题:PHP Sms::receive方法的具体用法?PHP Sms::receive怎么用?PHP Sms::receive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sms
的用法示例。
在下文中一共展示了Sms::receive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionReplyMessage
public function actionReplyMessage()
{
if (isset(Yii::app()->params['twilio']['replyMessage']) && Yii::app()->params['twilio']['replyMessage']) {
file_put_contents(Yii::app()->params['logDirPath'] . '/twilio_request.log', print_r($_REQUEST, true) . "\n\n", FILE_APPEND);
$phone = str_replace('+44', '', $_REQUEST['From']);
$client = Client::model()->findByPhone($phone);
$sms = new Sms();
$sms->clientId = $client ? $client->cli_id : 0;
$sms->receive($_REQUEST);
if ($client) {
$latestText = Sms::model()->latestTextToClient($client);
}
header('content-type: text/xml');
echo '<Response><Sms><![CDATA[' . Yii::app()->params['twilio']['replyMessage'] . ']]></Sms></Response>';
}
}
示例2: actionSms
public function actionSms($type = 'send', $batch = 0, $to = '', $content = '', $cardno = '', $cardpwd = '', $num = 2000, $once = 1)
{
$result = array();
$sms = new Sms();
switch ($type) {
case 'register':
$result = $sms->register();
break;
case 'send':
if (empty($batch)) {
$result = $sms->send($to, $content);
} else {
$result = $this->sendToAll($to, $content, $batch, $num, $once);
}
break;
case 'receive':
$result = $sms->receive();
if ($result['code'] == 200) {
$this->saveSmsReply($result['data']);
}
break;
case 'balance':
$result = $sms->balance();
break;
case 'chargup':
$result = $sms->chargUp($cardno, $cardpwd);
break;
default:
break;
}
var_dump($result);
}