本文整理汇总了PHP中Zend\Http\PhpEnvironment\Request::isPut方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::isPut方法的具体用法?PHP Request::isPut怎么用?PHP Request::isPut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Http\PhpEnvironment\Request
的用法示例。
在下文中一共展示了Request::isPut方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
/**
* @param string $name
* @param mixed $default
* @return mixed
*/
public function request($name, $default = null)
{
//The RequestInterface expects this method to return values from a form submission or from
//the decoded JSON body
if ($this->data === null) {
/* @var $contentType ContentType */
$mediaType = $this->httpRequest->getHeaders('Content-type') ? $this->httpRequest->getHeaders('Content-type')->getFieldValue() : null;
if ($mediaType == 'application/x-www-form-urlencoded' && ($this->httpRequest->isPut() || $this->httpRequest->isDelete())) {
parse_str($this->httpRequest->getContent(), $this->data);
} else {
if ($mediaType == 'application/json' && ($this->httpRequest->isPost() || $this->httpRequest->isPut() || $this->httpRequest->isDelete())) {
$this->data = json_decode($this->httpRequest->getContent(), true);
} else {
$this->data = $this->httpRequest->getPost()->toArray();
}
}
}
return isset($this->data[$name]) ? $this->data[$name] : $default;
}
示例2: TreatRequest
public function TreatRequest()
{
if ($this->IsAuthorized()) {
$request = new Request();
if ($request->isGet()) {
return $this->DoGet();
} else {
if ($request->isPost()) {
return $this->DoPost();
} else {
if ($request->isPut()) {
return $this->DoPut();
} else {
if ($request->isDelete()) {
return $this->DoDelete();
}
}
}
}
} else {
throw new \Exception();
}
}