本文整理汇总了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;
}