本文整理匯總了PHP中CakeRequest::method方法的典型用法代碼示例。如果您正苦於以下問題:PHP CakeRequest::method方法的具體用法?PHP CakeRequest::method怎麽用?PHP CakeRequest::method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CakeRequest
的用法示例。
在下文中一共展示了CakeRequest::method方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
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;
}
}
示例2: testMethod
/**
* Test the method() method.
*
* @return void
*/
public function testMethod()
{
$_SERVER['REQUEST_METHOD'] = 'delete';
$request = new CakeRequest('some/path');
$this->assertEquals('delete', $request->method());
}
示例3: _get_request
/**
* @param $data
*
* @return mixed
*/
protected function _get_request($data)
{
$request = new CakeRequest();
$data['request_user_agent'] = $request::header('User-Agent');
$data['request_client_ip'] = $request->clientIp();
$data['request_method'] = $request->method();
$data['request_referer'] = $request->referer();
$data['request_url'] = Router::url(null, true);
return $data;
}