Closed netcccyun closed 4 months ago
我晚上回去看一下
你好,请问看了吗
@netcccyun 编译swoole的时候加上--enable-swoole-curl
就可以了,你现在用的是以前协程化curl
的方法
Array
(
[url] => https://www.swoole.com/
[content_type] => text/html; charset=UTF-8
[http_code] => 200
[header_size] => 1151
[request_size] => 53
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.624566
[namelookup_time] => 0.058743
[connect_time] => 0.090391
[pretransfer_time] => 0.153779
[size_upload] => 0
[size_download] => 71309
[speed_download] => 114277
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0.306561
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 180.97.70.235
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => 192.168.1.2
[local_port] => 42470
[http_version] => 2
[protocol] => 2
[ssl_verifyresult] => 0
[scheme] => HTTPS
[appconnect_time_us] => 153726
[connect_time_us] => 90391
[namelookup_time_us] => 58743
[pretransfer_time_us] => 153779
[redirect_time_us] => 0
[starttransfer_time_us] => 306561
[total_time_us] => 624566
)
需要使用 native curl
Swoole版本:4.8.13 PHP版本:7.4.33 操作系统版本:CentOS 7.9
相关代码:
在使用上述curl协程化的代码,输出的namelookup_time、connect_time、pretransfer_time都是0,也就是获取不到这些耗时数据。只能拿到一个总耗时total_time。
但是不用协程的curl是可以拿到这些耗时数据的。有没有办法在协程里面拿到这些耗时数据?