本文整理匯總了PHP中Sms::sendSMS方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sms::sendSMS方法的具體用法?PHP Sms::sendSMS怎麽用?PHP Sms::sendSMS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sms
的用法示例。
在下文中一共展示了Sms::sendSMS方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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'));
}
}
示例2: sms
public function sms()
{
//注冊時發送的驗證碼
vendor('Sms.Sms');
$phone = $_POST["username"];
$method = $_POST["method"];
/*$rules=array(
array('username','','手機號已經存在!',0,'unique',1), // 在新增的時候驗證name字段是否唯一
);
*/
$user = M("user_manage");
//檢查手機號的合法性
if (preg_match("/1[34578]{1}\\d{9}/", $phone)) {
//$result=;
//isset($result));
if ($method == "lostpass") {
//找回密碼
if ($user->where("username={$phone} and state=1")->find()) {
$verify = rand(1000, 9999);
vendor('Msg.msg');
$msg = new \msg(M());
$m = $msg->createMsg(0, 'repass', array('validNum' => $verify));
//$m="您的驗證碼為$verify";
$sms = new \Sms();
$tag = $sms->sendSMS($phone, $m);
if ($tag == 1) {
//數據庫中改手機號已經注冊,但未注冊成功
$data["validity"] = time();
$data["verify"] = $verify;
$user->where("username={$phone}")->save($data);
}
echo $tag;
} else {
echo "手機號未注冊";
}
} else {
//首次注冊
//檢查手機號是否注冊成功
if ($user->where("username={$phone} and state=1")->find()) {
echo "手機號已經注冊";
} else {
$verify = rand(1000, 9999);
vendor('Msg.msg');
$msg = new \msg(M());
$m = $msg->createMsg(0, 'login', array('validNum' => $verify));
$sms = new \Sms();
$tag = $sms->sendSMS($phone, $m);
if ($tag == 1) {
$result = $user->where("username={$phone} and state=1")->find();
if ($result) {
//數據庫中改手機號已經注冊,但未注冊成功
$data["validity"] = time();
$data["verify"] = $verify;
$user->where("username={$phone}")->save($data);
} else {
//數據庫改手機號未注冊過
$data["username"] = $phone;
$data["state"] = 0;
$data["verify"] = $verify;
$data["validity"] = time();
$user->add($data);
}
}
echo $tag;
}
}
} else {
echo "您的手機號碼不合法";
}
}
示例3: Sms
$roles = "商戶管理員,管理商戶編號為" . $shop;
}
//發送短信通知
if ($role == 1) {
$sql = "select msgContext from msgModule where catID=0 and catName='addadmin'";
} else {
if ($role == 2) {
$sql = "select msgContext from msgModule where catID=0 and catName='addmall'";
} else {
$sql = "select msgContext from msgModule where catID=0 and catName='addshop'";
}
}
$msgresult = mysql_query($sql);
$row = mysql_fetch_array($msgresult);
$sms = new Sms();
$sms->sendSMS($phone, $row["msgContext"]);
//發送郵件通知
if ($role == 1) {
$sql = "select msgContext from msgModule where catID=1 and catName='addadmin'";
} else {
if ($role == 2) {
$sql = "select msgContext from msgModule where catID=1 and catName='addmall'";
} else {
$sql = "select msgContext from msgModule where catID=1 and catName='addshop'";
}
}
$msgresult = mysql_query($sql);
$row = mysql_fetch_array($msgresult);
$system_info_result = mysql_query("select * from system_info");
$system_info = mysql_fetch_array($system_info_result);
$smtp_info = explode("@", $system_info["email"]);