/**
* [SendSms description]
* @param [string] $tpl_content [發(fā)送的短信內(nèi)容]
* @param $send_mobile [發(fā)送的手機(jī)號(hào)碼]
*/
public function SendSms($tpl_content,$send_mobile)
{
$this->yunpian_appkey = env('yunpian_appkey');//云片賬戶appkey
$this->yunpian_secret = env('yunpianSecretXYZ');//云片賬戶secret
//初始化
$ch = curl_init();
$data=array('text'=>$tpl_content,'apikey'=>$this->yunpian_appkey,'mobile'=>$send_mobile);
curl_setopt ($ch, CURLOPT_URL, 'https://sms.yunpian.com/v2/sms/single_send.json');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept:text/plain;charset=utf-8', 'Content-Type:application/x-www-form-urlencoded', 'charset=utf-8'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$send_data = curl_exec($ch);
curl_close($ch);
//解析返回結(jié)果(json格式字符串)
$backmassage = json_decode($send_data,true);
echo '$backmassage ';
//這里是寫(xiě)在了job里面所以記了個(gè)日志可忽略!
Log::info('smsmessagelog: '.$send_data);
return [$backmassage,$send_data];
}