页面调用接口的时候,响应10s。通过使用xhprof监控,发现是调用接口超时。但是实际上接口超时的时候最多只允许2s,通过stream_set_timeout
进行了读流超时限制。
手册中有一些例子,其中有一段是这样说的:
If you are using fsockopen() to create a connection, first going to write into the stream and then waiting for the reply (e.g. simulating HTTP request with some extra headers), then stream_set_timeout() must be set only after the write - if it is before write, it has no effect on the read timeout :-(
但是实际上,按照这种写法进行了逻辑修改,依然是无效的。
认证高级PHP讲师