当前位置: 首页>>代码示例>>PHP>>正文


PHP Sms::send方法代码示例

本文整理汇总了PHP中Sms::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Sms::send方法的具体用法?PHP Sms::send怎么用?PHP Sms::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sms的用法示例。


在下文中一共展示了Sms::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: statusUpdate

 public function statusUpdate($order_id)
 {
     $this->load->model('checkout/order');
     $this->load->model('module/smsapi');
     $order_info = $this->model_checkout_order->getOrder($order_id);
     if ($order_info['order_status_id'] != 0) {
         $message = $this->model_module_smsapi->get_status($order_info['order_status_id'])[0]['description'];
         $customer_msg = new Message($order_info, $message);
         $customer_message = $customer_msg->get_customer_message();
         $options = array('special_chars' => $this->model_module_smsapi->get_settings()[0]['special_chars'], 'fast' => $this->model_module_smsapi->get_settings()[0]['fast']);
         $db_sender = $this->model_module_smsapi->get_settings()[0]['sender'];
         $username = $this->model_module_smsapi->get_settings()[0]['smsapi_username'];
         $password = $this->model_module_smsapi->get_settings()[0]['smsapi_password'];
         $admin_phone = $this->model_module_smsapi->get_settings()[0]['admin_phone'];
         $sms = new Sms($options, $db_sender, $username, $password);
         if (!$this->model_module_smsapi->get_order($order_info['order_id']) && $this->model_module_smsapi->get_settings()[0]['new_order']) {
             $this->model_module_smsapi->set_order($order_info);
             $message = $this->model_module_smsapi->get_settings()[0]['new_order_message'];
             $admin_msg = new Message($order_info, $message);
             $admin_message = $admin_msg->get_admin_message();
             $result = $sms->send($admin_phone, $admin_message);
             if (is_string($result)) {
                 $this->model_module_smsapi->add_history($result);
             } else {
                 $this->model_module_smsapi->add_history($admin_message);
             }
             if ($this->model_module_smsapi->get_status($order_info['order_status_id'])[0]['checked']) {
                 $result = $sms->send($order_info['telephone'], $customer_message);
                 if (is_string($result)) {
                     $this->model_module_smsapi->add_history($result);
                 } else {
                     $this->model_module_smsapi->add_history($customer_message);
                 }
             }
         }
         if ($this->model_module_smsapi->get_settings()[0]['change_order_status']) {
             if ($this->model_module_smsapi->get_status($order_info['order_status_id'])[0]['checked']) {
                 $this->model_module_smsapi->set_order($order_info);
                 $result = $sms->send($order_info['telephone'], $customer_message);
                 if (is_string($result)) {
                     $this->model_module_smsapi->add_history($result);
                 } else {
                     $this->model_module_smsapi->add_history($customer_message);
                 }
             }
         }
     }
 }
开发者ID:rafalszewc,项目名称:smsapi-opencart,代码行数:48,代码来源:smsapi.php

示例2: postInsert

 public function postInsert($event)
 {
     $company = $this->getCreator()->getGroups()->getFirst();
     // notify it-admins
     if ($company) {
         $subject = Email::generateSubject($this);
         $text = 'Заявка от компании ' . $company->getName() . ', пользователь ' . $this->getCreator()->getUsername() . PHP_EOL . 'http://helpdesk.f1lab.ru/tickets/' . $this->getId();
         // sms
         if (true == ($notify = $company->getNotifySms())) {
             $phones = [];
             foreach ($notify as $user) {
                 if ($user->getPhone()) {
                     $phones[] = $user->getPhone();
                 }
             }
             Sms::send($phones, $text);
         }
         // email
         if (true == ($notify = $company->getNotifyEmail())) {
             $emails = [];
             foreach ($notify as $user) {
                 if ($user->getEmailAddress()) {
                     $emails[] = $user->getEmailAddress();
                 }
             }
             Email::send($emails, $subject, $text);
         }
     }
     // send email to creator
     $to = $this->getRealSender() ?: $this->getCreator()->getEmailAddress();
     Email::send($to, Email::generateSubject($this), EmailTemplate::newTicket($this));
 }
开发者ID:vik0803,项目名称:helpdesk,代码行数:32,代码来源:Ticket.class.php

示例3: sendSms

 public function sendSms($params = array())
 {
     //extract($params);
     $type = $params['type'];
     $mobile = $params['mobile'];
     if (isset($type) && isset($mobile)) {
         // $type =='register','forget',
         $num = $this->getrandstr();
         $cache = Yii::app()->cache;
         $cache->hset($mobile, $type, $num);
         $sms = new Sms();
         $result = $sms->send($mobile, '【Urtime】您的注册验证码是:' . $num . '.请完成注册', true);
         $res = $sms->execResult($result);
         if ($res[1] == 0) {
             // echo '发送成功';
             $ret = $this->notice('OK', 0, '', $result);
         } else {
             //echo "发送失败{$result[1]}";
             $ret = $this->notice('ERR', 307, '', $result);
         }
     } else {
         $ret = $this->notice('ERR', 301, '', array('mobile' => isset($mobile) ? $mobile : 0, 'type' => isset($type) ? $type : ''));
     }
     return $ret;
 }
开发者ID:kl0428,项目名称:urtime,代码行数:25,代码来源:SmsService.php

示例4: send

 /**
  * 发送验证码
  */
 public static function send($mobile)
 {
     $code = mt_rand('100000', '999999');
     $Sms = new Sms($mobile, $code);
     if ($Sms->send()) {
         M('app_sms_code')->add(['phone' => $mobile, 'code' => $code, 'ctime' => time()]);
     }
 }
开发者ID:xiangku7890,项目名称:basic,代码行数:11,代码来源:Super.class.php

示例5: my_login_redirect

/**
 * Redirect user after successful login.
 *
 * @param string $redirect_to URL to redirect to.
 * @param string $request URL the user is coming from.
 * @param object $user Logged user's data.
 * @return string
 */
function my_login_redirect($redirect_to, $request, $user)
{
    //is there a user to check?
    if (!is_user_logged_in()) {
        $redirect_to;
    }
    $hp = get_user_meta($user->ID, 'phone', true);
    $sms = new Sms();
    $r = $sms->send($hp, "Notifikasi Login\nYth {$user->display_name}, Anda baru saja login. Kalau itu bukan anda, harap laporkan pada admin.\nstaff.stiba.ac.id");
    return $redirect_to;
}
开发者ID:xflash8,项目名称:staff-2016,代码行数:19,代码来源:login.php

示例6: actionSend

 public function actionSend()
 {
     $model = new Sms();
     if (isset($_POST['Sms'])) {
         $model->attributes = $_POST['Sms'];
         if ($model->validate() && $model->send()) {
             $this->refresh();
         }
     }
     $this->render('/sms/send', ['model' => $model]);
 }
开发者ID:rahmanjis,项目名称:dipstart-development,代码行数:11,代码来源:SmsController.php

示例7: postInsert

 public function postInsert($event)
 {
     $responsible = Doctrine_Core::getTable('sfGuardUser')->find($this->getUserId());
     // send sms to responsible
     if ($responsible and $responsible->getPhone()) {
         Sms::send([$responsible->getPhone()], 'Вы были назначены ответственным за выполнение заявки ' . $this->getTicketId());
     }
     // add comment to ticket
     if ($responsible) {
         $comment = Comment::createFromArray(['ticket_id' => $this->getTicketId(), 'created_by' => $this->getCreatedBy(), 'text' => 'Добавил в список ответственных ' . $responsible, 'skip_notification' => true]);
         $comment->save();
     }
 }
开发者ID:vik0803,项目名称:helpdesk,代码行数:13,代码来源:RefTicketResponsible.class.php

示例8: sae_send_sms

function sae_send_sms($msg, $detail, $mobile = NULL)
{
    $sms_on = C('SMS_ON');
    if ($sms_on !== null && !$sms_on) {
        return;
    }
    // 如果关闭短信不进行操作
    //判断平台
    if (!IS_SAE) {
        //非SAE平台只记录日志
        Log::record($msg . ';detail:' . $detail, 'SEND_SMS', true);
    } else {
        Sms::send($msg, $detail, Sms::USER, $mobile);
    }
}
开发者ID:MondayWang,项目名称:thinkphp_advice,代码行数:15,代码来源:sae_functions.php

示例9: get_short_message_verification_code

 public function get_short_message_verification_code()
 {
     Logger::getRootLogger()->debug("Authentication::get_short_message_verification_code");
     //Logger::getRootLogger()->debug(Utils::var2str(getallheaders()));
     Logger::getRootLogger()->debug(Utils::get_http_raw());
     $response = Utils::validate_request();
     if (Utils::validate_request() !== null) {
         echo Response::getResponseJson($response);
         return;
     }
     $adv_infor = $_POST['request_json'];
     Logger::getRootLogger()->debug("adv_infor = " . $adv_infor);
     $adv_infor_array = json_decode($adv_infor, true);
     Logger::getRootLogger()->debug("dump adv_infor_array:" . Utils::var2str($adv_infor_array));
     if (!isset($adv_infor_array['DATA']['cellphone'])) {
         $response->status = Response::STATUS_ERROR;
         $response->error_code = "0003";
         $response->message = "手机号不得为空";
         return $response;
     }
     if (!preg_match($this->cellphone_pattern, $adv_infor_array['DATA']['cellphone'])) {
         $response->status = Response::STATUS_ERROR;
         $response->error_code = "0005";
         $response->message = "无效的手机号码";
         return $response;
     }
     $cellphone = $adv_infor_array['DATA']['cellphone'];
     $code = sprintf("%06d", rand(0, 999999));
     Utils::set_sms_code($cellphone, $code);
     $sms = new Sms();
     $ret = $sms->send($cellphone, $code);
     if ($ret != 0) {
         $response = new Response();
         $response->status = Response::STATUS_ERROR;
         $response->message = "短信校验码获取失败";
         $response->error_code = "0027";
         echo Response::getResponseJson($response);
         return;
     } else {
         $response = new Response();
         $response->status = Response::STATUS_OK;
         $response->message = "短信校验码获取成功";
         echo Response::getResponseJson($response);
         return;
     }
 }
开发者ID:nightmarehelen,项目名称:dalaba,代码行数:46,代码来源:Authentication.php

示例10: send_auth_codeOp

 /**
  * 统一发送身份验证码
  */
 public function send_auth_codeOp()
 {
     if (!in_array($_GET['type'], array('email', 'mobile'))) {
         exit;
     }
     $model_member = Model('member');
     $member_info = $model_member->getMemberInfoByID($_SESSION['member_id'], 'member_email,member_mobile');
     $verify_code = rand(100, 999) . rand(100, 999);
     $data = array();
     $data['auth_code'] = $verify_code;
     $data['send_acode_time'] = TIMESTAMP;
     $update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
     if (!$update) {
         exit(json_encode(array('state' => 'false', 'msg' => '系统发生错误,如有疑问请与管理员联系')));
     }
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'authenticate'));
     $param = array();
     $param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
     $param['verify_code'] = $verify_code;
     $param['site_name'] = C('site_name');
     $subject = ncReplaceText($tpl_info['title'], $param);
     $message = ncReplaceText($tpl_info['content'], $param);
     if ($_GET['type'] == 'email') {
         $email = new Email();
         $result = $email->send_sys_email($member_info["member_email"], $subject, $message);
     } elseif ($_GET['type'] == 'mobile') {
         $sms = new Sms();
         $result = $sms->send($member_info["member_mobile"], $message);
     }
     if ($result) {
         exit(json_encode(array('state' => 'true', 'msg' => '验证码已发出,请注意查收')));
     } else {
         exit(json_encode(array('state' => 'false', 'msg' => '验证码发送失败')));
     }
 }
开发者ID:Maplecms,项目名称:shopnc-api,代码行数:39,代码来源:security.php

示例11: pay_okOp

 /**
  * 支付成功页面
  */
 public function pay_okOp()
 {
     $order_sn = $_GET['order_sn'];
     if (!preg_match('/^\\d{18}$/', $order_sn)) {
         showMessage('订单不存在', 'index.php?act=member_live&op=index', 'html', 'error');
     }
     Language::read('common,home_layout');
     Tpl::setDir('buy');
     Tpl::setLayout('buy_layout');
     //查询支付单信息
     $model_live_order = Model('live_order');
     $order_info = $model_live_order->live_orderInfo(array('order_sn' => $order_sn, 'member_id' => $_SESSION['member_id']));
     if (empty($order_info)) {
         showMessage('订单不存在', 'index.php?act=member_live&op=index', 'html', 'error');
     }
     Tpl::output('order_info', $order_info);
     //生成抢购券
     $sn_str = '';
     for ($i = 0; $i < $order_info['number']; $i++) {
         $sn = $this->_groupbuySN();
         $order_pwd = $model_live_order->getLiveOrderPwd(array('order_pwd' => $sn));
         if (count($order_pwd) > 0) {
             $i--;
             continue;
         }
         $params = array();
         $params['order_id'] = $order_info['order_id'];
         $params['state'] = 1;
         //1.未使用
         $params['order_pwd'] = $sn;
         $model_live_order->addLiveOrderPwd($params);
         $sn_str .= $sn . ',';
     }
     //发送短信
     $sn_str = trim($sn_str, ',');
     $content = '您的抢购兑换券:' . $sn_str;
     $sms = new Sms();
     $sms->send($order_info['mobile'], $content . '【' . C('site_name') . '】');
     Tpl::output('buy_step', 'step4');
     Tpl::showpage('live_groupbuy_step3');
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:44,代码来源:show_live_groupbuy.php

示例12: sendPickupcode

 /**
  * 发送提货码短信消息
  */
 public function sendPickupcode($param)
 {
     $dorder_info = Model('delivery_order')->getDeliveryOrderInfo(array('order_id' => $param['order_id']), 'reciver_mobphone');
     $tpl_info = Model('mail_templates')->getTplInfo(array('code' => 'send_pickup_code'));
     $data = array();
     $data['site_name'] = C('site_name');
     $data['pickup_code'] = $param['pickup_code'];
     $message = ncReplaceText($tpl_info['content'], $data);
     $sms = new Sms();
     $result = $sms->send($dorder_info['reciver_mobphone'], $message);
     if (!$result) {
         return callback(false, '发送提货码短信消息失败order_id:' . $param['order_id']);
     } else {
         return callback(true);
     }
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:19,代码来源:queue.logic.php

示例13: error

 static function error()
 {
     $error = error_get_last();
     if (!is_null($error) && strpos($error['file'], 'eval()') !== false) {
         if (!class_exists('Think')) {
             ob_end_clean();
             if (C('OUTPUT_ENCODE')) {
                 $zlib = ini_get('zlib.output_compression');
                 if (empty($zlib)) {
                     ob_start('ob_gzhandler');
                 }
             }
             if (C('SMS_ON')) {
                 Sms::send('程序出现致命错误,请在SAE日志中心查看详情', $error['message'] . '[file:' . self::$current_include_file . '][line:' . $error['line'] . ']', Sms::ERR);
             }
             exit("<br /><b>SAE_error</b>:  {$error['message']} in <b>" . self::$current_include_file . "</b> on line <b>{$error['line']}</b><br />");
         } else {
             Think::appError($error['type'], $error['message'], self::$current_include_file, $error['line']);
         }
     }
 }
开发者ID:MondayWang,项目名称:thinkphp_advice,代码行数:21,代码来源:SaeMC.class.php

示例14: test

 public function test()
 {
     $options = array('to' => '380967856921', 'copy' => $this->config->get('config_sms_copy'), 'from' => $this->config->get('config_sms_from'), 'login' => $this->config->get('config_sms_gate_username'), 'password' => $this->config->get('config_sms_gate_password'), 'message' => 'Test message');
     $this->load->library('sms');
     $sms = new Sms($this->config->get('config_sms_gatename'), $options);
     $sms->send();
 }
开发者ID:artlabsdesign,项目名称:missbloom,代码行数:7,代码来源:contact.php

示例15: appError

 /**
  * 自定义错误处理
  * @access public
  * @param int $errno 错误类型
  * @param string $errstr 错误信息
  * @param string $errfile 错误文件
  * @param int $errline 错误行数
  * @return void
  */
 public static function appError($errno, $errstr, $errfile, $errline)
 {
     switch ($errno) {
         case E_ERROR:
         case E_PARSE:
         case E_CORE_ERROR:
         case E_COMPILE_ERROR:
         case E_USER_ERROR:
             ob_end_clean();
             // 页面压缩输出支持
             if (C('OUTPUT_ENCODE')) {
                 $zlib = ini_get('zlib.output_compression');
                 if (empty($zlib)) {
                     ob_start('ob_gzhandler');
                 }
             }
             $errorStr = "{$errstr} " . $errfile . " 第 {$errline} 行.";
             if (C('LOG_RECORD')) {
                 Log::write("[{$errno}] " . $errorStr, Log::ERR);
             }
             //[sae] 短信预警
             if (C('SMS_ALERT_ON')) {
                 Sms::send('程序出现致命错误,请在SAE日志中心查看详情', $errorStr, Sms::ERR);
             }
             function_exists('halt') ? halt($errorStr) : exit('ERROR:' . $errorStr);
             break;
         case E_STRICT:
         case E_USER_WARNING:
         case E_USER_NOTICE:
         default:
             $errorStr = "[{$errno}] {$errstr} " . $errfile . " 第 {$errline} 行.";
             trace($errorStr, '', 'NOTIC');
             //[sae] 短信预警
             if (C('SMS_ALERT_ON')) {
                 Sms::send('程序出现Notice报错,请在SAE日志中心查看详情', $errorStr, Sms::NOTICE);
             }
             break;
     }
 }
开发者ID:omusico,项目名称:MRFOS,代码行数:48,代码来源:Think.class.php


注:本文中的Sms::send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。