CakeRequest::method PHP Method

method() public method

There are a few ways to specify a method. - If your client supports it you can use native HTTP methods. - You can set the HTTP-X-Method-Override header. - You can submit an input with the name _method Any of these 3 approaches can be used to set the HTTP method used by CakePHP internally, and will effect the result of this method.
public method ( ) : string
return string The name of the HTTP method used.
    public function method()
    {
        return env('REQUEST_METHOD');
    }

Usage Example

Esempio n. 1
0
 public function handle()
 {
     if ($this->_logger instanceof Syncroton_Log) {
         $this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' REQUEST METHOD: ' . $this->_request->method());
     }
     switch ($this->_request->method()) {
         case 'OPTIONS':
             $this->_handleOptions();
             break;
         case 'POST':
             $this->_handlePost();
             break;
         case 'GET':
             header("MS-Server-ActiveSync: 14.00.0536.000");
             echo "It works!<br>Your userid is: {$this->_userId} and your IP address is: {$_SERVER['REMOTE_ADDR']}.";
             break;
     }
 }
All Usage Examples Of CakeRequest::method