file_get_content 的超时时间问题 
                            
                                                    
                        
                    
                    
  
                    
                            $opts = [
            'http' => [
                'method'  => 'POST',
                'header'  => "Content-type: application/json;charset=UTF-8;Content-Length: " . strlen($data),
                'timeout' => 30,
                'content' => $data,
            ],
        ];
        //文本数据流创建
        $context = stream_context_create($opts);
        return file_get_contents($url, false, $context);
这个超时时间 设置的是 30s,但是我测试下来是 60s (就是请求另一个接口,那个接口 sleep(100))
不过有接口好像确实是在 30s 就失败了,感觉有点迷。。。
所以这个 timeout 参数就是准确的吗? 没有 connection-timeout 和 正式的 request-timeout 一说之类的?
 
           
         
                     
                     
           
           关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号 
 
测试下来 ,是 timeout *2的执行时间。。 迷了
stackoverflow.com/questions/102361...
网络请求还是curl吧 :joy: