PHP:curl_setopt_array给出通知“数组到字符串转换” [英] PHP: curl_setopt_array gives notice "array to string conversion"

查看:723
本文介绍了PHP:curl_setopt_array给出通知“数组到字符串转换”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

curl_setopt_array($ ch,$ curl_opt);

此代码提供通知注意:在...中数组到字符串转换

这是 $ curl_opt contains:

This is what $curl_opt contains:

array (size=5)
  42 => boolean true
  19913 => boolean true
  10018 => string 'PHP RestClient/0.1.2' (length=20)
  10005 => 
    array (size=1)
      0 => string 'user:password' (length=13)
  10002 => string 'http://longurl.com/' (length=389)

is_array($ curl_opt)返回 true ,所以我不知道是什么引起通知。

is_array($curl_opt) returns true, so I don't really know what's causing the notice.

我想我只是在这里简单地缺少一些东西,但是我只是不能,在我的生活中,这一个。

I think I'm just missing something really simple here but I just cannot, for the life of me, figure this one out.

这只是一个通知,并没有打破任何东西,但它只是惹恼我,我不知道是什么造成它。

It's just a notice and doesn't break anything but it just annoys me that I don't know what's causing it.

推荐答案

$ curl_opt 应为 / strong> array ................................

$curl_opt should be a one-dimensional array................................

10005 不是这种情况,应该是

The key 10005 is not that case, it should be

$curl_opt = array(
  //...
  CURLOPT_USERPWD => '[username]:[password]'
  //...
);

这篇关于PHP:curl_setopt_array给出通知“数组到字符串转换”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆