Handling PUT/DELETE arguments in PHP

前端 未结 6 1257
盖世英雄少女心
盖世英雄少女心 2020-11-30 21:30

I am working on my REST client library for CodeIgniter and I am struggling to work out how to send PUT and DELETE arguments in PHP.

In a few places I have seen peopl

6条回答
  •  萌比男神i
    2020-11-30 22:33

    I think you're mixing your verbs - PUT is for putting a file, POST is for posting variables (although you can POST a file).

    To set the post variables, use CURLOPT_POSTFIELDS with either a string of param1=val1¶m2=val2 or an associative array.

    To do a DELETE, you'll want to use the curl option CURLOPT_CUSTOMREQUEST

提交回复
热议问题