当前位置: 首页>>代码示例>>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;未经允许,请勿转载。