You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< ? php
namespace juhe\message ;
class Message extends Base
{
/**
* 发送短信
* @param string $mobile_phone 接收短信的手机号码
* @param string $template_id 短信模板ID
* @param array $tpl_value 变量名和变量值对,如:#code#=431515, 整串值需要urlencode, 比如正确结果为: %23code%23%3d431515。如果你的变量名或者变量值中带有#&=中的任意一个特殊符号, 请先分别进行utf-8 urlencode编码后再传递
* @param string $sign_name 短信签名 必须是已添加、并通过审核的短信签名
* @date 2021-02-18
*/
public function sendSms ( $mobile_phone , $template_id , $tpl_value = '' )
{
$url = $this -> url . 'sms/send' ;
$params = array (
'key' => $this -> config [ 'key' ], //您申请的APPKEY
'mobile' => $mobile_phone , //接受短信的用户手机号码
'tpl_id' => $template_id , //您申请的短信模板ID, 根据实际情况修改
'tpl_value' => $tpl_value //您设置的模板变量,根据实际情况修改
);
$param_string = http_build_query ( $params );
$result = http_data_post ( $url , $param_string , 0 );
// 记录日志
$uid = defined ( 'UID' ) ? UID : '' ;
platformLog ( $params , $result , 'juhe_send_message_uid_' . $uid );
return $result ;
}
}