/** * @param $mobile 手机号码 * @param $project summail project * @param $option 短信参数 * @return mixed * @throws Exception */ static function sendsms($mobile, $project, $option) { require_once PATH_LIBS . '/submail/SUBMAILAutoload.php'; $submail = new MESSAGEXsend(PtApp::$setting['submail']['message']); $submail->AddTo($mobile); $submail->SetProject($project); foreach ($option as $a => $b) { $submail->AddVar($a, $b); } try { $xsend = $submail->xsend(); if (!$xsend['status']) { throw new Exception('短信未发送成功,返回null'); } if ($xsend['status'] == 'error') { throw new Exception($xsend['msg']); } return $xsend; } catch (Exception $e) { throw new Exception($e->getMessage()); } }
|recipient cell phone number |@Multi-para |-------------------------------------------------------------------------- */ $submail->AddTo('18616761881'); /* |Optional para |-------------------------------------------------------------------------- |set addressbook sign : Optional |add addressbook contacts to Multi-Recipients |@Multi-para |-------------------------------------------------------------------------- */ //$submail->AddAddressbook('subscribe'); /* |Required para |-------------------------------------------------------------------------- |set message project sign |-------------------------------------------------------------------------- */ $submail->SetProject('kZ9Ky3'); /* |Optional para |-------------------------------------------------------------------------- |submail email text content filter |@Multi-para |-------------------------------------------------------------------------- */ $submail->AddVar('code', '198276'); $xsend = $submail->xsend(); print_r($xsend);