DELETE:

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

PUT:

curl_setopt($ch, CURLOPT_PUT, true);

GET:

curl_setopt($ch, CURLOPT_HTTPGET, true);

POST:

curl_setopt($ch, CURLOPT_POST, true);

可以通过$_SERVER['REQUEST_METHOD']获得请求类型,

PUT/DELETE的参数可以这样获取:

parse_str(file_get_contents('php://input'), $request_vars);

注意:

parsestr(filegetcontents('php://input'), $requestvars); 只能取application/x-www-form-urlencoded格式的数据!!!!!!

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2021-05-24
相关资源
相似解决方案