防超时的file_get_contents改造函数

function wp_file_get_contents($url)
{
    $context = stream_context_create(array(
        'http' => array(
            'timeout' => 30
        )
    )); // 超时时间,单位为秒

    return file_get_contents($url, 0, $context);
}

猜你喜欢

转载自blog.csdn.net/weixin_39712497/article/details/80334717