PHP——post(实例)

来源:互联网 发布:苹果免费office软件 编辑:程序博客网 时间:2024/06/10 21:42
    public static function post($url, $data){//file_get_content        $postdata = http_build_query(            $data        );        $opts = array('http' =>                      array(                          'method'  => 'POST',                          'header'  => 'Content-type: application/x-www-form-urlencoded',                          'content' => $postdata                      )        );        $context = stream_context_create($opts);        $result = file_get_contents($url, false, $context);        return $result;    }


原创粉丝点击