使用curl multi exec的foreach循环

时间:2018-05-07 12:44:11

标签: curl foreach curl-multi

我试图找出如何在foreach循环中使用curl multi exec发送多个curl请求。我写了一些代码,但它没有向我显示获取数据,我不明白,

感谢提前帮助

这是我的代码:

def upload_pics(request, user_id):
    if request.method == "POST":
    form = FileForm(request.POST, request.FILES)
    files = request.FILES.getlist('file_field')
    if form.is_valid():
        pics = form.save(commit=False)
        pics.user = request.user
        pics.files = request.FILES[files]
        return redirect("groups:index")

else:
    form = FileForm()
    render(request, 'accounts/account_form.html', {'form':form})
return render(request, 'accounts/account_form.html', {'form':form})

另一方面,当我使用curl_init单个请求时,它返回数据但不使用curl multi exec,它会返回此内容。

  

数组([0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => ; [16] => [17] => [18] => [19] => [20] => [21] => [22] => [23] => [ 24] => [25] => [26] => [27] => [28] => [29] => [30] => [31] => [32] => [33] => [34] => [35] => [36] => [37] => [38] => [39] => [40] => ; [41] => [42] => [43] => [44] => [45] => [46] => [47] => [48] => [ 49] =>)

我希望我会得到一些答案! :-)

0 个答案:

没有答案