uploadMedia()上传临时素材 * * * * * ~~~ /** * 上传临时素材 * 上传临时素材,有效期为3天(认证后的订阅号可用) * @param string filePath 注意是物理路径 * @param string 类型:图片:image 语音:voice 视频:video 缩略图:thumb */ function uploadMedia($filePath = '', $type = '') { $weObj = getWechatActiveObj(); $media = $weObj->uploadMedia(['media' => '@' . ROOT_PATH . $filePath], $type); if (empty($media)) { ajaxMsg(0, 'errCode:' . $weObj->errCode . 'errMsg' . $weObj->errMsg); } return $media; } ~~~