这套系统运行速度是真心快啊!模拟post/get请求

Home / Article 遗忘悠剑 2020-7-9 3251

嗖嗖的! 楼主这套主题很漂亮哈!

/**
 * 模拟Post\Get请求  file_get_contents方式
 *
 * @param string 	$url 	执行请求的Url
 * @param mixed	$post_data 表单参数
 * @param string	$Method 请求方法 post / get
 * @param int	$timeOut 等待时间 s
 * @return string 结果字串
 */
function json_post($url, $post_data,$Method='POST',$timeOut = 10) {
    $options = array(
        'http' => array(
            'method' => $Method,
            'header' => 'Content-type:application/json;charset=utf-8 ',
            'content' => $post_data,
            'timeout' => $timeOut
        ));
    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    return $result;
}

讲真,爱了爱了~ 可惜原作者居然含恨放弃了~

本文链接:https://www.it72.com/12650.htm

推荐阅读
最新回复 (5)
返回