getRedis($md5); $r->set('game2005:voice:' . $md5, $data); $r -> pexpire('game2005:voice:' . $md5, 1000 * 600); $url = ''; if (SERVER_ENV == _ONLINE) { $url = "https://game2005api.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5; } else { $url = "https://game2005api-test.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5; } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'download_url' => $url )); } public function download() { $r = $this->getRedis($_REQUEST['res_id']); $data = $r->get('game2005:voice:' . $_REQUEST['res_id']); echo base64_decode($data); } }