移动物联网卡短信发送和接收源码,php+vue+tp6版本,支持中文;
开发流程
1)提供移动相关的账号
2)提供服务器,ip需要做好在移动的备份
3)linux 服务器
4)配置workman所需要的环境
5)配置php7.3环境
6)配置redis数据库
7)配置短信发送源码
8)配置短信发送源码
短信发送采用的workman进行发送,通过redis数据库进行数据中转
Timer::add($this->conf['send_task_cd'], function() use ($redis, $con){
// $data = $redis->lpop( $this->conf['redis_key']['task']);
$data = $redis->lpop('flowhn_taskA');
if (empty($data)) {
$this->wlog('发送队列为空 ...', self::LOG_RUN);
}else{
$this->wlog($data, self::LOG_RUN);
}
$array = json_decode( $data, true );
// $array=array(
// 'mobile'=>'17703734005',
// 'content'=>'17703734005',
// );
if ($array && isset($array['mobile']) && isset($array['content'])) {
$this->send_msg_ascii($con, $array['mobile'], $array['content']);
$this->wlog(
"[短信发送]: 卡号={$array['mobile']}, 内容={$array['content']}",
self::LOG_RUN
);
// $array['content']=mb_convert_encoding($array['content'], "UTF-8", "auto");
// $cont=mb_convert_encoding( $array['content'], "ASCII", 'UTF-8' );
// $this->wlog(
// "[短信发送]: 卡号={$array['mobile']}, 内容={$cont}",
// self::LOG_RUN
// );
}
return;
});