正在显示
1 个修改的文件
包含
6 行增加
和
6 行删除
@@ -229,15 +229,15 @@ class SalesmangoodsController extends WeChatBaseController{ | @@ -229,15 +229,15 @@ class SalesmangoodsController extends WeChatBaseController{ | ||
229 | $filepath = $_POST['mediaId'];//文件的绝对路径 | 229 | $filepath = $_POST['mediaId'];//文件的绝对路径 |
230 | $str = date('YmdHis').mt_rand('100','999').'.jpg'; | 230 | $str = date('YmdHis').mt_rand('100','999').'.jpg'; |
231 | $targetName = '/uploads/'.$str; | 231 | $targetName = '/uploads/'.$str; |
232 | - cache('msgssss',$targetName); | 232 | + |
233 | $ch = curl_init("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath"); | 233 | $ch = curl_init("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath"); |
234 | - cache('a1',1111); | ||
235 | - $fp = fopen($targetName, 'w'); | ||
236 | - cache('a100',2222); | 234 | + |
235 | + $fp = fopen($targetName, 'wb'); | ||
236 | + | ||
237 | curl_setopt($ch, CURLOPT_FILE, $fp); | 237 | curl_setopt($ch, CURLOPT_FILE, $fp); |
238 | - cache('a200',3333); | 238 | + |
239 | curl_setopt($ch, CURLOPT_HEADER, 0); | 239 | curl_setopt($ch, CURLOPT_HEADER, 0); |
240 | - cache('a300',4444); | 240 | + |
241 | $msg["status"] = curl_exec($ch); | 241 | $msg["status"] = curl_exec($ch); |
242 | $msg["filename"] = $str; | 242 | $msg["filename"] = $str; |
243 | curl_close($ch); | 243 | curl_close($ch); |
-
请 注册 或 登录 后发表评论