作者 anyv
1 个管道 的构建 通过 耗费 0 秒

4

... ... @@ -212,7 +212,7 @@ class SalesmangoodsController extends WeChatBaseController{
public function text(){
dump(cache('msgsss'));
dump(cache('msgssss'));
}
... ... @@ -225,6 +225,7 @@ class SalesmangoodsController extends WeChatBaseController{
$filepath = $_POST['mediaId'];//文件的绝对路径
$str = date('YmdHis').mt_rand('100','999').'.jpg';
$targetName = '/uploads/'.$str;
cache('msgssss',$targetName);
$ch = curl_init("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath");
$fp = fopen($targetName, 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
... ... @@ -233,7 +234,7 @@ class SalesmangoodsController extends WeChatBaseController{
$msg["filename"] = $str;
curl_close($ch);
fclose($fp);
cache('msgsss',$targetName);
return json_encode($msg);
}
... ...