當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sms類代碼示例

本文整理匯總了PHP中Sms的典型用法代碼示例。如果您正苦於以下問題:PHP Sms類的具體用法?PHP Sms怎麽用?PHP Sms使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Sms類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionDelete

 public function actionDelete()
 {
     $id = $this->_get('id');
     $user_id = $this->_get('user_id');
     $obj = User::model()->findByPk($user_id);
     if ($id && Report::model()->deleteByPk($id)) {
         $mobile = $obj->mobile;
         if (isset($mobile) && $mobile) {
             // $type =='register','forget',
             $sms = new Sms();
             $result = $sms->sendSMS($mobile, '您好,你的反饋我們已近收到,我們將盡快處理,Urtime謝謝你的寶貴意見', 'true');
             $result = $sms->execResult($result);
             if ($result[1] == 0) {
                 // echo '發送成功';
                 Yii::app()->user->setFlash('send', 1);
                 $this->redirect(array('report/index'));
             } else {
                 //echo "發送失敗{$result[1]}";
                 Yii::app()->user->setFlash('send', 0);
                 $this->redirect(array('report/index'));
             }
         } else {
             Yii::app()->user->setFlash('report', 0);
             $this->redirect(array('report/index'));
         }
     } else {
         Yii::app()->user->setFlash('report', 0);
         $this->redirect(array('report/index'));
     }
 }
開發者ID:kl0428,項目名稱:admin,代碼行數:30,代碼來源:ReportController.php

示例2: actionLogin

 public function actionLogin()
 {
     $data = array();
     $params = Yii::$app->request->getBodyParams();
     if (isset($params['acc_device_token'])) {
         $devisetoken = $params['acc_device_token'];
     } else {
         $devisetoken = "";
     }
     $sms = new Sms();
     $vcode = $sms->checkVerifyCode($params['mobile'], $params['code'])['error'];
     if ($vcode == 0) {
         $userdata = Accounts::get_user_by_mobile($params['mobile']);
         if (empty($userdata)) {
             $access_token = Yii::$app->security->generateRandomString();
             $this->userReg($params['mobile'], $devisetoken, $access_token);
             $userdata = Accounts::get_user_by_mobile($params['mobile']);
             if (!$userdata) {
                 return Message::say(Message::E_ERROR, null, "登錄錯誤");
             }
         }
         return Message::say(Message::E_OK, $userdata, "登錄成功");
     } else {
         return Message::say(Message::E_ERROR, null, "驗證碼錯誤");
     }
 }
開發者ID:szucyq,項目名稱:zhaopin,代碼行數:26,代碼來源:SiteController.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: 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

示例6: 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

示例7: actionIndex

 /**
  * 首頁
  *
  */
 public function actionIndex()
 {
     parent::_acl('sms_index');
     $model = new Sms();
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }
開發者ID:zywh,項目名稱:maplecity,代碼行數:18,代碼來源:SmsController.php

示例8: 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

示例9: POST_phoneAction

 /**
  * 發送手機驗證碼
  * @method POST_phoneAction
  * @author NewFuture
  */
 public function POST_phoneAction()
 {
     $response['status'] = 0;
     if (!Input::post('phone', $phone, Config::get('regex.phone'))) {
         $response['info'] = '手機號格式有誤或者不支持!';
     } elseif (!Input::post('account', $account, Config::get('regex.account'))) {
         $response['info'] = '賬號有誤,如果賬號忘記請聯係雲印工作人員';
     } elseif (!($Printer = PrinterModel::where('account', $account)->field('id,phone')->find())) {
         $response['info'] = '尚未注冊';
     } elseif (!Safe::checkTry('pwd_phone_' . $account)) {
         $response['info'] = '嘗試次數過多,臨時封禁!';
     } elseif (!$Printer['phone'] || $Printer['phone'] != $phone) {
         $response['info'] = '綁定手機不一致,或者手機號錯誤';
     } elseif (!Sms::findPwd($phone, $code = Random::number(6))) {
         $response['info'] = '短信發送出錯,請聯係我們!';
     } else {
         /*發送成功*/
         $find = ['id' => $Printer['id'], 'account' => $account, 'code' => strtoupper($code)];
         Session::set('find_info_p', $find);
         Safe::del('pwd_phone_' . $account);
         $response['status'] = 1;
         $response['info'] = '驗證短信已發送';
     }
     $this->response = $response;
 }
開發者ID:derek-chow,項目名稱:YunYinService,代碼行數:30,代碼來源:Password.php

示例10: POST_phoneAction

 /**
  * 發送手機驗證碼
  * @method POST_phoneAction
  * @author NewFuture
  */
 public function POST_phoneAction()
 {
     $response['status'] = 0;
     if (!Input::post('phone', $phone, Config::get('regex.phone'))) {
         $response['info'] = '手機號格式有誤或者不支持!';
     } elseif (!Input::post('number', $number, 'card')) {
         $response['info'] = '學號格式有誤!';
     } elseif (!Safe::checkTry('pwd_phone_' . $number)) {
         $response['info'] = '嘗試次數過多,臨時封禁!';
     } elseif (!($user = UserModel::where('number', $number)->field('id,phone')->find())) {
         $response['info'] = '尚未注冊,或者學號錯誤';
     } elseif (empty($user['phone'])) {
         $response['info'] = '未綁定手機號,或者學號錯誤';
     } elseif (Encrypt::encryptPhone($phone, $number, $user['id']) != $user['phone']) {
         $response['info'] = '綁定手機不一致,或者手機號錯誤';
     } elseif (!Sms::findPwd($phone, $code = Random::code(6))) {
         $response['info'] = '短信發送出錯,請聯係我們!';
     } else {
         /*發送成功*/
         $find = ['id' => $user['id'], 'number' => $number, 'code' => strtoupper($code)];
         Session::set('find_info', $find);
         Safe::del('pwd_phone_' . $number);
         $response['status'] = 1;
         $response['info'] = '短信已發送';
     }
     $this->response = $response;
 }
開發者ID:derek-chow,項目名稱:YunYinService,代碼行數:32,代碼來源:Password.php

示例11: 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

示例12: smssendtest

 public function smssendtest()
 {
     if (strlen($_GET['mp']) != 11) {
         $this->error('請輸入正確的手機號');
     }
     $this->error(Sms::sendSms('admin', 'hello,你好', $_GET['mp']));
 }
開發者ID:d0oo0b,項目名稱:wechatcms,代碼行數:7,代碼來源:SiteAction.class.php

示例13: index

 public function index($orderid, $paytype, $third_id)
 {
     $product_cart_model = M('product_cart');
     $out_trade_no = $orderid;
     $order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
     if (!$this->wecha_id) {
         $this->wecha_id = $order['wecha_id'];
     }
     $sepOrder = 0;
     if (!$order) {
         $order = $product_cart_model->where(array('id' => $out_trade_no))->find();
         $sepOrder = 1;
     }
     if ($order) {
         if ($order['paid'] != 1) {
             exit('該訂單還未支付');
         }
         /************************************************/
         Sms::sendSms($this->token, '您的微信裏有團購訂單已經付款');
         /************************************************/
         header('Location:/index.php?g=Wap&m=Groupon&a=myOrders&token=' . $order['token'] . '&wecha_id=' . $order['wecha_id']);
     } else {
         exit('訂單不存在:' . $out_trade_no);
     }
 }
開發者ID:node-rookie,項目名稱:bdg,代碼行數:25,代碼來源:ThirdPayGroupon.class.php

示例14: 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>';
     }
 }
開發者ID:jankichaudhari,項目名稱:yii-site,代碼行數:16,代碼來源:TwilioController.php

示例15: index

 public function index()
 {
     $set_id = $this->_get('id', 'intval');
     $formData = $this->_createForms($this->token, $set_id);
     if (IS_POST) {
         $limit_info = $this->limit_db->where(array('limit_id' => $this->thisForm['limit_id']))->find();
         if ($limit_info['enddate']) {
             if ($limit_info['enddate'] < time()) {
                 $this->error('抱歉,時間已過期,無法提交');
             }
         }
         if (0 < $limit_info['today_total']) {
             $time = strtotime(date('Y-m-d'));
             $total = $this->info_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'set_id' => $this->thisForm['set_id'], 'add_time' => array('gt', $time)))->count();
             if ($limit_info['today_total'] <= $total) {
                 $this->error('抱歉,今日隻能提交' . $limit_info['today_total'] . '次');
             }
         }
         if (0 < $limit_info['sub_total']) {
             $total = $this->info_db->where(array('token' => $this->token, 'set_id' => $this->thisForm['set_id'], 'wecha_id' => $this->wecha_id))->count();
             if ($limit_info['sub_total'] <= $total) {
                 $this->error('抱歉,提交總數已經超過' . $limit_info['sub_total'] . '次');
             }
         }
         $data['token'] = $this->token;
         $data['wecha_id'] = $this->wecha_id;
         $data['set_id'] = $set_id;
         $data['add_time'] = time();
         $data['user_name'] = empty($this->fans['wechaname']) ? '匿名' : $this->fans['wechaname'];
         $data['phone'] = empty($this->fans['tel']) ? '匿名' : $this->fans['tel'];
         $array = array();
         foreach ($this->_request() as $key => $value) {
             if ($value == '') {
                 $array[] = array($key => '未填寫');
             }
         }
         $arr = array();
         foreach ($array as $k => $v) {
             foreach ($v as $key => $value) {
                 $arr[$key] = $value;
             }
         }
         $b = $this->_request();
         $request = array_merge($b, $arr);
         $data['sub_info'] = $this->_serializeSubInfo($request, $set_id);
         if ($this->info_db->add($data)) {
             Sms::sendSms($this->token, '你的表單“' . $this->thisForm['title'] . '”中有新的信息');
             $this->success($this->thisForm['succ_info']);
         } else {
             $this->error($this->thisForm['err_info']);
         }
     } else {
         $spoor = $this->info_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'set_id' => $set_id))->count();
         $this->assign('spoor', $spoor);
         $this->assign('verify', $formData['verify']);
         $this->assign('formData', $formData['string']);
         $this->display();
     }
 }
開發者ID:hehekeke,項目名稱:pigcms,代碼行數:59,代碼來源:CustomAction.class.php


注:本文中的Sms類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。