Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

素材管理 -- 部分图片下载失败 #13

Closed
lazyou opened this issue May 4, 2015 · 1 comment
Closed

素材管理 -- 部分图片下载失败 #13

lazyou opened this issue May 4, 2015 · 1 comment

Comments

@lazyou
Copy link

lazyou commented May 4, 2015

下载图片出现如下错误 :

有的图片能下载,有的图片不能下载的情况。
错误如下:

[2015-05-04 10:47:47] local.ERROR: exception 'ErrorException' with message 'Undefined offset: 1' in /var/www/meishenghuo/web/vendor/overtrue/wechat/src/Wechat/Utils/Http.php:228

我的解决方法如下,但是不知道这样做对不(能解决部分图片不能下载问题)。

Wechat\Utils\Http.php的 request() 方法下 :

$responseSplit = preg_split('/((?:\r?\n){2})/', $response['response']);

正则分割 header和 body的时候出现了 body被拆分成两部分的情况(本该是

$responseSplit = array(0=>"header信息", 1=>"body信息");

结果变成

$responseSplit = array(0=>"header信息", 1=>"body1信息", 2=>"body2信息"); )。

我把正则内的 \r 后面的 ? 问号去掉就能解决问题(不懂为什么)。

$responseSplit = preg_split('/((?:\r\n){2})/', $response['response']);

@overtrue
Copy link
Collaborator

overtrue commented May 5, 2015

@lazyou 麻烦加一下QQ: 44294631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants