在使用示例程序微信支付平台证书下载的代码的时候出现错误
Closed this issue · 3 comments
naohwen commented
curl_setopt_array(): cannot represent a stream of type Output as a STDIO FILE*
不懂怎么解决?
naohwen commented
$resp = $instance->chain('v3/certificates')->get(
);
把debug去掉就好了
TheNorthMemory commented
用 debug => true
参数在github上做了部分搜索,相似问题:
- CURLrequest fix debug verbose
- Debug request option causes fatal error.
- CURLRequest - supplied argument is not a valid File-Handle resource #Windows x64
源头基本都指向了 windows 平台上的PHP“怪异”行为,底层原因可能是 PHP 在Windows上是非 epoll
模型运行时,而 STDOUT
这个只读流拷贝,在数据写入时是需要线程级交错,而windows上的PHP线程控制可能会获取不到预期文件句柄 -> proc_open,进而向上冒泡至 curl
扩展引起不达预期错误。。。
建议在开发环境,尤其windows平台,确实需要调试时,指定一个有效的形如 debug => fopen('x:\filepath\debug.txt', 'a')
这样的文件句柄,可能是比较妥当的方式。