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

4

... ... @@ -218,8 +218,8 @@ class SalesmangoodsController extends WeChatBaseController{
$access_token=$this->getAccessToken();
$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);
$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");
$fp = fopen($targetName, 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
... ...