阅读背景:

重构file_get_contents实现一个带超时POST传值函数

来源:互联网 
function wp_file_post_contents($url, $post = null)
{
    $context = array();

    if (is_array($post))
    {
        ksort($post);
        $context['http'] = array
        (
            'timeout'=> 60,
            'method' => 'POST',
            'content' => http_build_query($post, '', '&'),
        );
    }
    
    $context = stream_context_create($context);
    return file_get_contents($url, false, $context);
}function wp_file_post_contents($url, $post = nu



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: