file_get_contents防止超时
发布时间:2021-07-14 18:18:58
作者:admin
阅读:1063次
解决file_get_contents超时
-
<?php
-
$ctx = stream_context_create(array(
-
'http' => array(
-
'timeout' => 1 //设置一个超时时间,单位为秒
-
)
-
)
-
);
-
file_get_contents("http://example.com/", 0, $ctx);
-
?>
如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术
有疑问联系站长,请联系QQ: