微信录音上传至七牛云控制器代码

tech2023-01-24  99

//移动端录音上传并保存; function heartUpload() { checkAuth(); global $CONF; //ajax传递$serverId; $serverId = trim($_POST["serverId"]); //处理微信服务器语音; require 'libs/wx/jssdk.php'; $saveMedia = new JSSDK($CONF['wx_appid'], $CONF['wx_appSecret']); //保存音频在本地服务器; $saveMedia->saveMedia($serverId); //上传至七牛云并转码; require 'libs/QiNiu.php'; $qiniu = new QINIU; //读取目录 //$dateStr = date('Y-m-d', time()); $path = ROOT_PATH . "/upload/";// . $dateStr . '/' $filename = $serverId . ".amr"; $qiniu->upchange($CONF['qn_accessKey'], $CONF['qn_secretKey'], $CONF['qn_bucket'], $CONF['qn_pipeline'], $path . $filename, $serverId); //添加录音文件到语音管理系统; require DASH_BOARD . '/model/index.php'; //返回信息; //$data['err'] = '赞!您的'; $data['err'] = '赞!您的'; die(json_encode($data)); }

Done!

最新回复(0)