Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to: <a href="http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/" rel="noreferrer">http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/</a> we should consult <a href="https://github.com/philsturgeon/codeigniter-restserver/blob/master/application/libraries/REST_Controller.php#L544" rel="noreferrer">https://github.com/philsturgeon/codeigniter-restserver/blob/master/application/libraries/REST_Controller.php#L544</a> to see that this method:</p> <pre><code>/** * Detect method * * Detect which method (POST, PUT, GET, DELETE) is being used * * @return string */ protected function _detect_method() { $method = strtolower($this-&gt;input-&gt;server('REQUEST_METHOD')); if ($this-&gt;config-&gt;item('enable_emulate_request')) { if ($this-&gt;input-&gt;post('_method')) { $method = strtolower($this-&gt;input-&gt;post('_method')); } else if ($this-&gt;input-&gt;server('HTTP_X_HTTP_METHOD_OVERRIDE')) { $method = strtolower($this-&gt;input-&gt;server('HTTP_X_HTTP_METHOD_OVERRIDE')); } } if (in_array($method, array('get', 'delete', 'post', 'put'))) { return $method; } return 'get'; } </code></pre> <p>looks to see if we've defined the HTTP header <code>HTTP_X_HTTP_METHOD_OVERRIDE</code> and it uses that in favor of the actual verb we've implemented on the web. To use this in a request you would specify the header <code>X-HTTP-Method-Override: method</code> (so <code>X-HTTP-Method-Override: put</code>) to generate a custom method override. Sometimes the framework expects <code>X-HTTP-Method</code> instead of <code>X-HTTP-Method-Override</code> so this varies by framework.</p> <p>If you were doing such a request via jQuery, you would integrate this chunk into your ajax request:</p> <pre><code>beforeSend: function (XMLHttpRequest) { //Specify the HTTP method DELETE to perform a delete operation. XMLHttpRequest.setRequestHeader("X-HTTP-Method-Override", "DELETE"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload