LEN

PHP 中 file_get_contents($url) 设置超时
废话少说 直接上代码:<?php $url = 'http://www.baidu.com'; ...
扫描右侧二维码阅读全文
27
2019/02

PHP 中 file_get_contents($url) 设置超时

废话少说 直接上代码:

<?php
    $url = 'http://www.baidu.com';
    $context = stream_context_create(array(
        "http" => [
            "timeout" => 3
        ],
    ));

    $result = file_get_contents($url, 0 $context);

    var_dump($result);
Last modification:February 27th, 2019 at 11:50 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment