本文整理匯總了PHP中messenger::sendSms方法的典型用法代碼示例。如果您正苦於以下問題:PHP messenger::sendSms方法的具體用法?PHP messenger::sendSms怎麽用?PHP messenger::sendSms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類messenger
的用法示例。
在下文中一共展示了messenger::sendSms方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exec
public function exec($params = null)
{
$result = messenger::sendSms($params['sms'], $params['tmpl'], $params['content']);
if ($result['rsp'] == "succ") {
return true;
} else {
return false;
}
}
示例2: testSend
public function testSend()
{
$content = array('vcode' => rand(1000, 9999));
$sms = "13816353470";
$m = messenger::sendSms($sms, 'account-member', $content);
if ($m['rsp'] == "fail") {
echo $m['err_msg'];
exit;
}
echo "發送短信成功";
exit;
}
示例3: send_sms
public function send_sms($type, $mobile)
{
if (!($tmpl = $this->sendtypeToTmpl($type))) {
return false;
}
$vcodeData = $this->checkVcode($mobile, $type);
$vcode = $this->randomkeys(6);
$vcodeData['account'] = $mobile;
$vcodeData['vcode'] = $vcode;
$vcodeData['count'] += 1;
$vcodeData['createtime'] = date('Ymd');
$vcodeData['lastmodify'] = time();
$data['vcode'] = $vcode;
$key = $this->getVcodeKey($mobile, $type);
$result = messenger::sendSms($mobile, $tmpl, $data);
if ($result['rsp'] == "fail") {
throw new \LogicException(app::get('system')->_('驗證碼發送失敗!'));
}
if (defined('WITHOUT_CACHE') && !constant('WITHOUT_CACHE')) {
cacheobject::set($key, $vcodeData, $this->ttl + time());
} else {
base_kvstore::instance('vcode/account')->store($key, $vcodeData, $this->ttl);
}
return true;
}