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

7

... ... @@ -219,7 +219,7 @@ class SalesmangoodsController extends WeChatBaseController{
$filepath = $_POST['mediaId'];//文件的绝对路径
$str = date('YmdHis').random(12).'.jpg';
$targetName = '/uploads/'.date('Ymd').'/'.$str;
$ch = curl_int("https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=$access_token&media_id=$filepath");
$ch = curl_int("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);
curl_setopt($ch, CURLOPT_HEADER, 0);
... ...