删除带有file_get_contents的请求


DELETE request with file_get_contents

file_get_contents方法可以执行GET或POST请求。我想知道是否可以使用此方法执行 DELETE 请求。我像下面一样尝试,但它似乎没有执行删除请求。我也没有收到任何错误或异常。这可能吗?

$postdata = http_build_query($param);
$opts = array('http' =>
        array(
            'method'  => 'DELETE',
            'header'  => 'Content-type: application/x-www-form-urlencoded',
            'content' => $postdata
        )
    );
$context  = stream_context_create($opts);
$result = file_get_contents($url, false, $context);

$result = file_get_contents( "http://example.com/submit.php", 假 stream_context_create(array( 'http' => array( "方法" => "删除" ) )));