聯(lián)系官方銷(xiāo)售客服
1835022288
028-61286886
請(qǐng)問(wèn)如何判斷當(dāng)前的驗(yàn)證碼是來(lái)自用戶(hù)注冊(cè)還是修改手機(jī)還是重置密碼?
官方代碼中的短信發(fā)送方法中傳遞的參數(shù)無(wú)法判斷,現(xiàn)在需要根據(jù)不同的操作發(fā)送不同的短信模板,請(qǐng)問(wèn)有什么辦法,謝謝。
public function sendsms_text($mobile, $content, $type = 'text') { if (!$mobile || !$content) { return dr_return_data(0, dr_lang('手機(jī)號(hào)碼或內(nèi)容不能為空')); } $file = WRITEPATH.'config/sms.php'; if (!is_file($file)) { log_message('error', '短信接口配置文件不存在'); return dr_return_data(0, dr_lang('接口配置文件不存在')); } $config = require_once $file; if ($config['third']) { if (is_file(ROOTPATH.'config/mysms.php')) { require_once ROOTPATH.'config/mysms.php'; } $method = 'my_sendsms_'.$type; if (function_exists($method)) { return call_user_func_array($method, [ $mobile, $content, $config['third'], ]); } else { $error = dr_lang('你沒(méi)有定義第三方短信接口: '. $method); @file_put_contents(WRITEPATH.'sms_log.php', date('Y-m-d H:i:s').' ['.$mobile.'] ['.$error.'] ('.str_replace(array(chr(13), chr(10)), '', $content).')'.PHP_EOL, FILE_APPEND); return dr_return_data(0, $error); } } else { $content = $type == 'code' ? dr_lang('您的本次驗(yàn)證碼是: %s', $content) : $content; $url = 'http://223987.com/index.php?s=vip&c=home&uid='.$config['uid'].'&key='.$config['key'].'&mobile='.$mobile.'&content='.$content.'【'.$config['note'].'】&domain='.trim(str_replace('http://', '', SITE_URL), '/').'&sitename='.SITE_NAME; $result = dr_catcher_data($url); if (!$result) { log_message('error', '訪(fǎng)問(wèn)官方云短信服務(wù)器失敗'); return dr_return_data(0, dr_lang('訪(fǎng)問(wèn)官方云短信服務(wù)器失敗')); } $result = json_decode($result, true); } @file_put_contents(WRITEPATH.'sms_log.php', date('Y-m-d H:i:s').' ['.$mobile.'] ['.$result['msg'].'] ('.str_replace(array(chr(13), chr(10)), '', $content).')'.PHP_EOL, FILE_APPEND); return $result; }
這個(gè)判斷不了,是公共類(lèi)
回復(fù)迅??蚣軇?chuàng)始人 好的明白了,希望可以在原函數(shù)sendsms_text()中加入一個(gè)自由參數(shù),由開(kāi)發(fā)者自行傳參,已在后臺(tái)提交建議工單,希望可以采納,謝謝。
一樓說(shuō)的一定對(duì),除非自己寫(xiě)接口了