本文整理汇总了PHP中send_sms函数的典型用法代码示例。如果您正苦于以下问题:PHP send_sms函数的具体用法?PHP send_sms怎么用?PHP send_sms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_sms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 发送短信
*
* @access public
* @return boolean
*/
public function index()
{
$start_time = strtotime('-1 day 16:00');
$end_time = 0;
if (date('H') <= '11:10') {
if (date('w') == 1 && (time() >= 1443628800 && time() < 1444492800)) {
$start_time = strtotime('last Friday 16:00');
}
$end_time = strtotime('today 11:01');
} else {
$start_time = strtotime('today 11:01:01');
$end_time = strtotime('today 16:01');
}
$this->load->model('Cash_order_model', 'cash_order');
$report = $this->cash_order->sum(array('money'), array('start_time' => date("Y-m-d H:i:s", $start_time), 'end_time' => date("Y-m-d H:i:s", $end_time), 'status' => 'pending'));
$report['money'] = !empty($report['money']) ? $report['money'] : 0;
$content = date('m月d日 H:i', $start_time) . ' 至 ' . date('m月d日 H:i', $end_time) . " 提现统计:";
$content .= "¥{$report['money']}元";
$content .= '【图腾贷】';
$phone_arr = $this->phone;
foreach ($phone_arr as $ph) {
send_sms($ph, array('template' => 'cashreport_template', 'start_time' => date('m月d日H:i', $start_time), 'end_time' => date('m月d日H:i', $end_time), 'money' => $report['money']));
}
$msg = '-----------------' . date('Y-m-d H:i:s') . '提现统计-----------------';
$msg .= "\n{$content}";
//记录日志
log_message('error', $msg, 'cash_report');
return true;
}
示例2: error_handler
function error_handler($errno, $errstr, $errfile, $errline)
{
$dt_tm = date("Y-m-d H:i:s");
$log = "[{$dt_tm}] {$errstr} in {$errfile} at {$errline}\n";
file_put_contents("/var/www/test/update/log/errors.log", $log, FILE_APPEND);
$err_return;
switch ($errno) {
case E_USER_ERROR:
case E_ERROR:
$err_return = "[{$dt_tm}]\nError: {$errstr} in file {$errfile} at {$errline}";
send_sms($err_return, $errfile, $errline);
exit(1);
break;
case E_USER_WARNING:
case E_WARNING:
$err_return = "[{$dt_tm}]\nWarning: {$errstr} in file {$errfile} at {$errline}";
break;
case E_USER_NOTICE:
case E_NOTICE:
$err_return = "[{$dt_tm}]\nNotice: {$errstr} on line {$errline} at {$errfile}\n";
break;
default:
$err_return = "[{$dt_tm}]\n{$errstr} in {$errfile} at {$errline}";
break;
}
send_sms($err_return, $errfile, $errline);
return true;
}
示例3: send
/**
* 发送手机短信
* @param unknown $mobile 手机号
* @param unknown $content 短信内容
*/
public function send($mobile, $content)
{
$plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', C('sms.plugin'))));
if (!empty($plugin)) {
define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
require_once PLUGIN_ROOT . DS . $plugin . DS . 'Send.php';
return send_sms($content, $mobile);
}
return $this->_sendEmay($mobile, $content);
}
示例4: send_sms
public function send_sms()
{
if (!IS_SAE && !C('SAE_AKEY')) {
exit('在本地执行发送短信函数,需要配置SAE_AKEY和SAE_SKEY<br />');
}
$ret = send_sms(18611052787, '发送一条短信');
if (!$ret) {
$this->show('短信发送失败,请在trace信息中看失败原因');
} else {
$this->show('短信发送成功');
}
}
示例5: phonecodesend
/**
*短信验证处理
*
*Return $msg,ok为正常处理,pass为次数超出 ,having 为已经注册了,time 为时间限定条件,三分钟内不发
*/
public function phonecodesend()
{
$phone = I('param.phone', 'null');
$code = strtolower(randCode());
//随机验证码
$condition['telephone'] = $phone;
$usercheck = M('user', 'yijiayi.')->where($condition)->find();
//用户是否存在
$sessionValue = array('phone' => $phone, 'time' => time(), 'value' => $code, 'number' => '1');
//缓存数据设置
$checktruecode = session('getsession');
$codeTime = date("d", $checktruecode['time']);
$nowTime = date("d", time());
/**
*判定是否存在session 空,发
*判定session时间有效性
*/
$tpl_value = '【一家依】您的验证码是' . $code;
//发送信息的母板
if (empty($usercheck)) {
if (empty($checktruecode)) {
//session 为空
echo 'need to setting session';
$_SESSION['getsession'] = $sessionValue;
send_sms('cf34160f4719430181a3d387f9dda3c8', $tpl_value, $phone);
//发送信息
$res_code = "ok";
//操作成功标注
} else {
if ($codeTime != $nowTime) {
//当天没发送记录
send_sms('cf34160f4719430181a3d387f9dda3c8', $tpl_value, $phone);
$_SESSION['getsession'] = $sessionValue;
$res_code = "ok";
} else {
if ($checktruecode['number'] <= '5') {
//当天没发送记录>5
$setNumber = $checktruecode['number'] + "1";
$_SESSION['getsession'] = array('phone' => $phone, 'time' => time(), 'value' => $code, 'number' => $setNumber);
send_sms('cf34160f4719430181a3d387f9dda3c8', $tpl_value, $phone);
$type = "ok";
} else {
$type = "pass";
}
$res_code = $type;
}
}
} else {
$res_code = "having";
}
$res_data['msg'] = $res_code;
$this->ajaxReturn($res_data);
}
示例6: notifications
function notifications($type, $recipients, $subject, $message)
{
if ($type == "both") {
send_sms($recipients, $subject, $message);
send_email($recipients, $subject, $message);
} else {
if ($type == "sms") {
send_sms($recipients, $subject, $message);
} else {
if ($type == "email") {
send_email($recipients, $subject, $message);
}
}
}
}
示例7: sendsms
public function sendsms()
{
$end = session('smstime') + 90 - time();
if ($end > 1) {
$this->error('距离上一次发送还有' . $end . '秒');
} else {
$phone = session('user.phone');
$code = rand(10000, 99999);
session('smscode', $code, 90);
session('smstime', time());
if (is_sms()) {
$sms_message = '验证码:' . $code;
send_sms($phone, $sms_message);
$this->success('短信已发送至手机!');
} else {
$this->success($code);
}
}
}
示例8: send_notice
function send_notice($username, $subject, $body)
{
global $DT, $msg, $eml, $sms, $wec;
if (!$username || !$subject || !$body) {
return;
}
if (isset($msg)) {
send_message($username, $subject, $body);
}
if (isset($wec)) {
send_weixin($username, $subject);
}
if (isset($eml) || isset($sms)) {
$user = userinfo($username);
if (isset($eml)) {
send_mail($user['email'], $subject, $body);
}
if (isset($sms)) {
send_sms($user['mobile'], $subject . $DT['sms_sign']);
}
}
}
示例9: send
public function send($message, $tonumbers)
{
if (!is_array($tonumbers)) {
$tonumbers = array($tonumbers);
}
$sender = $this->getParameter(self::SENDER_PARAM);
$message = iconv('UTF-8', 'CP1251', htmlspecialchars($message));
$results = array();
foreach ($tonumbers as $to) {
$result = array();
if (!empty($to)) {
$result = send_sms($to, $message, 0, 0, 0, 0, $sender, "fmt=1", $this->_username, $this->_password);
$sms_id = $result[0];
$result['to'] = $to;
if (!empty($sms_id)) {
$result['id'] = $sms_id . ":::" . $to;
$status = get_status($sms_id, $to, 0, $this->_username, $this->_password);
$result['status'] = self::MSG_STATUS_PROCESSING;
if (count($status) > 2) {
$result['statusmessage'] = $this->_msg_status[$status[0]];
} else {
$result['statusmessage'] = $this->_msg_status[substr($status[1], 1)];
}
} else {
$result['error'] = true;
$result['status'] = self::MSG_STATUS_ERROR;
$result['statusmessage'] = $this->_msg_error[substr($result[1], 1)];
}
} else {
$result['to'] = 'Incorrect phone';
$result['error'] = true;
$result['status'] = self::MSG_STATUS_ERROR;
$result['statusmessage'] = 'Ошибочный номер телефона';
}
$results[] = $result;
}
return $results;
}
示例10: elseif
} elseif ($act == 'set_teaallow') {
$templates = label_replace($SMStemplates['set_teaallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_teanotallow') {
$templates = label_replace($SMStemplates['set_teanotallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_couallow') {
$templates = label_replace($SMStemplates['set_couallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_counotallow') {
$templates = label_replace($SMStemplates['set_counotallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_applycou') {
$templates = label_replace($SMStemplates['set_applycou']);
send_sms($_GET['mobile'], $templates);
} elseif ($act == 'set_downapp') {
$templates = label_replace($SMStemplates['set_downapp']);
send_sms($_GET['mobile'], $templates);
} elseif ($act == 'set_hunallow') {
$templates = label_replace($SMStemplates['set_hunallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_hunnotallow') {
$templates = label_replace($SMStemplates['set_hunnotallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_hunjobsallow') {
$templates = label_replace($SMStemplates['set_hunjobsallow']);
send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_hunjobsnotallow') {
$templates = label_replace($SMStemplates['set_hunjobsnotallow']);
send_sms($userinfo['mobile'], $templates);
}
示例11: send_mobile_sms_user
send_mobile_sms_user($SEND_TIME, $_SESSION['LOGIN_USER_ID'], $USER_ID_STR, $SMS_CONTENT, 1);
}
}
include_once "inc/itask/itask.php";
mobile_push_notification(userid2uid($USER_ID_STR), $_SESSION['LOGIN_USER_NAME'] . _(":") . _("请查看公告通知") . _("标题:") . csubstr($SUBJECT, 0, 20), "notify");
$WX_OPTIONS = array("module" => "notify", "module_action" => "notify.read", "user" => $USER_ID_STR, "content" => $_SESSION['LOGIN_USER_NAME'] . _(":") . _("请查看公告通知") . _("标题:") . csubstr($SUBJECT, 0, 20), "params" => array("NOTIFY_ID" => $NOTIFY_ID));
wxqy_sms($WX_OPTIONS);
}
if ($PUBLISH == "2") {
$SMS_CONTENT = _("请审批公告通知!") . "\n" . _("标题:") . csubstr($SUBJECT, 0, 100);
if (compare_date($BEGIN_DATE1, $CUR_DATE) == 1) {
$SEND_TIME = $BEGIN_DATE1;
}
$REMIND_URL = "1:notify/auditing/unaudited.php";
if ($SMS_REMIND == "on" && $AUDITER != "" && $AUDITER != $_SESSION['LOGIN_USER_ID']) {
send_sms($SEND_TIME, $_SESSION['LOGIN_USER_ID'], $AUDITER, 1, $SMS_CONTENT, $REMIND_URL);
}
if ($SMS2_REMIND == "on") {
$SMS_CONTENT = sprintf(_("请审批OA公告,来自%s"), $_SESSION['LOGIN_USER_NAME'] . ":" . $SUBJECT);
if ($SUMMARY) {
$SMS_CONTENT .= _("内容简介:") . $SUMMARY;
}
if ($AUDITER != "" && $AUDITER != $_SESSION['LOGIN_USER_ID']) {
send_mobile_sms_user($SEND_TIME, $_SESSION['LOGIN_USER_ID'], $AUDITER, $SMS_CONTENT, 1);
}
}
}
if ($OP == "0" && ($PUBLISH == "0" || $PUBLISH == "5")) {
if ($OP1 == 1) {
header("location: modify.php?NOTIFY_ID=" . $NOTIFY_ID . "&FROM={$FROM}");
} else {
示例12: foreach
$sql2 = "VALUES ('" . $_POST['name'] . "','" . $_POST['dept'] . "','" . $_POST['phone'] . "','" . $_POST['qq'] . "','" . $_POST['task'] . "','" . $_POST['startdate'] . "','" . $_POST['enddate'];
foreach ($_POST as $key => $value) {
if (preg_match('/content/', $key)) {
$sql1 .= ',' . $key;
$sql2 .= "','" . $value;
}
}
$sql1 .= ',tid) ';
$sql2 .= "','" . $tid . "')";
$sql = $sql1 . $sql2;
$conn = new mysqli($mysqlServer, $mysqlUser, $mysqlPass, $mysqlDbName);
if ($conn->connect_error) {
header('Location: applyResult.php?info=2');
exit;
}
if ($conn->query($sql) === TRUE) {
$smsContent = '【三翼工作室】' . $adminName . '您好,系统收到了新的申请' . $tid . ':' . $_POST['task'] . '。请登陆管理系统进行审核![设计部]';
$sendResultJson = send_sms($apiKey, $sendUrl, $adminPhone, $smsContent);
$sendResult = json_decode($sendResultJson);
if ($sendResult->code == '0') {
header('Location: applyResult.php?info=1&tid=' . $tid);
exit;
} else {
header('Location: applyResult.php?info=3&tid=' . $tid . '&reason=' . $sendResult->msg);
exit;
}
} else {
header('Location: applyResult.php?info=2&tid=' . $tid);
exit;
}
$conn->close();
示例13: send_message
function send_message($mode, $id, $message, $msgid, $oplata = 0)
{
#echo "send_message:\n";
global $LMS, $DB, $tmpl, $debug_email, $test, $divisor, $force;
$customer = $LMS->GetCustomer($id);
if ($mode == 'e-mail') {
$emails = $customer['emails'];
#print_r($emails);
if (is_array($emails)) {
foreach ($emails as $email) {
$body = parse_data($id, $tmpl['message'], $customer);
$name = $customer['lastname'] . ' ' . $customer['name'];
$email = $debug_email ? $debug_email : $email['email'];
if (!$test) {
$result = send_email($msgid, $customer['id'], $email, $name, $tmpl['name'], $body);
}
$message .= " {$result}\n";
}
} else {
if ($test) {
$message .= " Brak e-maila!\n";
} else {
$message = '';
}
}
} elseif ($mode == 'sms') {
$data = parse_data($id, $tmpl['message'], $customer);
#echo $data."\n";
$sms = 0;
if (!is_array($customer['contacts'])) {
if ($test) {
return $message . " Brak nr telefonów!\n";
}
}
foreach ($customer['contacts'] as $contact) {
if ($contact['type'] == 1) {
$sms = 1;
if (!$test) {
$result = send_sms($msgid, $customer['id'], $contact['phone'], $data);
}
$message .= ' ' . $contact['phone'];
if ($oplata) {
if (!$test) {
$add = array('value' => -ConfigHelper::getConfig('finances.sms_cost'), 'userid' => 0, 'customerid' => $customer['id'], 'comment' => 'Opłata za monitorowanie płatności - SMS');
if ($LMS->AddBalance($add)) {
$message .= ' [K]';
}
}
}
}
}
if (!$sms) {
if ($test) {
$message .= " Brak nr komórkowych!\n";
} else {
$message = '';
}
} else {
$message .= "\n";
}
} else {
$warning = 0;
$access = 1;
$nodes = $LMS->GetCustomerNodes($customer['id']);
$groups = $LMS->CustomergroupGetForCustomer($customer['id']);
if (count($groups)) {
foreach ($groups as $group) {
if ($group['name'] == 'SILENT') {
#return(''); #opcja:
return "S " . $message . "\n";
}
}
}
if (count($nodes)) {
foreach ($nodes as $node) {
$access *= $node['access'];
if ($node['warning']) {
$warning = 1;
}
}
}
if (!$access) {
#return(''); #opcja:
$message = "! " . $message . "\n";
} elseif ($warning and !$force) {
#return(''); #opcja:
$message = "* " . $message . "\n";
} else {
if (!$test) {
$DB->Execute("UPDATE customers SET message='" . $tmpl['message'] . "' WHERE id=" . $customer['id']);
$LMS->NodeSetWarnU($customer['id'], 1);
}
if ($force) {
if ($warning) {
$message = "F " . $message . "\n";
} else {
$message = " " . $message . "\n";
}
} else {
$message = " " . $message . "\n";
//.........这里部分代码省略.........
示例14: exit
if ($_SESSION['mobile_time'] && $DT_TIME - $_SESSION['mobile_time'] < 180) {
exit('ko');
}
if ($_SESSION['mobile_send'] > 4) {
exit('max');
}
if (max_sms($mobile)) {
exit('max');
}
$mobilecode = random(6, '0123456789');
$_SESSION['mobile'] = $mobile;
$_SESSION['mobile_code'] = md5($mobile . '|' . $mobilecode);
$_SESSION['mobile_time'] = $DT_TIME;
$_SESSION['mobile_send'] = $_SESSION['mobile_send'] + 1;
$content = lang('sms->sms_code', array($mobilecode, $MOD['auth_days'] * 10)) . $DT['sms_sign'];
send_sms($mobile, $content);
exit('ok');
}
exit('ko');
break;
case 'verify':
isset($code) or $code = '';
preg_match("/^[0-9]{6}\$/", $code) or exit('ko');
isset($password) or $password = '';
strlen($password) >= $MOD['minpassword'] && strlen($password) <= $MOD['maxpassword'] or exit('ko');
isset($_SESSION['f_uid']) && isset($_SESSION['f_key']) or exit('ko');
$userid = intval($_SESSION['f_uid']);
$t = $db->get_one("SELECT email,mobile,vmobile,groupid FROM {$DT_PRE}member WHERE userid='{$userid}'");
$t or exit('ko');
if ($t['groupid'] == 2 || $t['groupid'] == 4) {
exit('ko');
示例15: strtok
if ($TOK == "" || find_id($strSEND, $TOK)) {
$TOK = strtok(",");
} else {
$strSEND .= $TOK . ",";
if ($BODY_ID == "" || $BODY_ID == 0) {
message(_("错误"), _("邮件发送错误,请重新发送!"));
exit;
}
if ($SEND_FLAG == 1) {
$query = "insert into EMAIL(TO_ID,READ_FLAG,DELETE_FLAG,BODY_ID,RECEIPT) values ('" . $TOK . "','0','0','{$BODY_ID}','{$RECEIPT}')";
exequery(TD::conn(), $query);
$ROW_ID = mysql_insert_id();
if ($SMS_REMIND == "1") {
$REMIND_URL = "email/inbox/read_email/read_email.php?BOX_ID=0&BTN_CLOSE=1&FROM=1&EMAIL_ID=" . $ROW_ID;
$SMS_CONTENT = _("请查收我的邮件!") . "\n" . _("主题:") . csubstr($SUBJECT1, 0, 100);
send_sms("", $_SESSION['LOGIN_USER_ID'], $TOK, 2, $SMS_CONTENT, $REMIND_URL);
}
$WX_NEED_USER_ID_ARR[] = $TOK;
include_once "inc/itask/itask.php";
mobile_push_notification(userid2uid($TOK), $_SESSION['LOGIN_USER_NAME'] . _(":") . _("请查收我的邮件!") . _("主题:") . csubstr($SUBJECT1, 0, 20), "email");
}
$EMAIL_FW_WEBMAIL_BOX_ARRAY = email_fw_webmail_box($TOK);
if ($EMAIL_FW_WEBMAIL_BOX_ARRAY[1] != "" && $EMAIL_FW_WEBMAIL_BOX_ARRAY[0] != "" && $SEND_FLAG == 1) {
$WEBMAIL_CONTENT_FW = mysql_escape_string($CONTENT);
$FROM_WEBMAIL1 = $EMAIL_FW_WEBMAIL_BOX_ARRAY[0];
$TO_EMAIL_FW_WEBMAIL_BOX = $EMAIL_FW_WEBMAIL_BOX_ARRAY[1];
if ($ATTACHMENT_ID != "" && $ATTACHMENT_NAME != "") {
$ATTACHMENT_ID = copy_attach($ATTACHMENT_ID, $ATTACHMENT_NAME, "", "", TRUE);
if ($ATTACHMENT_ID != "") {
$ATTACHMENT_ID .= ",";
}