本文整理汇总了PHP中Nette\Http\IRequest::isMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP IRequest::isMethod方法的具体用法?PHP IRequest::isMethod怎么用?PHP IRequest::isMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Http\IRequest
的用法示例。
在下文中一共展示了IRequest::isMethod方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirectUrl
/**
* Redirect to another URL and ends presenter execution.
* @param string
* @param int HTTP error code
* @return void
* @throws Nette\Application\AbortException
*/
public function redirectUrl($url, $code = NULL)
{
if ($this->isAjax()) {
$this->payload->redirect = (string) $url;
$this->sendPayload();
} elseif (!$code) {
$code = $this->httpRequest->isMethod('post') ? Http\IResponse::S303_POST_GET : Http\IResponse::S302_FOUND;
}
$this->sendResponse(new Responses\RedirectResponse($url, $code));
}
示例2: match
/**
* Tries to match request
*
* @param \Nette\Http\IRequest $httpRequest
*
* @return \Nette\Application\Request|NULL
*/
public function match(\Nette\Http\IRequest $httpRequest)
{
foreach ($this->methods as $method) {
// method is not matched, return null
if ($httpRequest->isMethod($method)) {
return parent::match($httpRequest);
}
}
return null;
}
示例3: handleResponse
/**
* Signal for receive a response from gateway.
*/
public function handleResponse()
{
$data = $this->httpRequest->isMethod(IRequest::POST) ? $this->httpRequest->getPost() : $this->httpRequest->getQuery();
$response = NULL;
try {
$response = $this->client->receiveResponse($data);
} catch (Csob\Exception $e) {
if ($response === NULL && $e instanceof Csob\ExceptionWithResponse) {
$response = $e->getResponse();
}
$this->onError($this, $e, $response);
return;
}
$this->onResponse($this, $response);
}
示例4: processRequest
/**
* Handles incoming request and sets translations.
*/
private function processRequest()
{
if ($this->httpRequest->isMethod('post') && $this->httpRequest->isAjax() && $this->httpRequest->getHeader(self::XHR_HEADER)) {
$data = json_decode(file_get_contents('php://input'));
if ($data) {
$this->translator->setCurrentLang($data->{self::LANGUAGE_KEY});
if ($data->{self::NAMESPACE_KEY}) {
$this->translator->setNamespace($data->{self::NAMESPACE_KEY});
}
unset($data->{self::LANGUAGE_KEY}, $data->{self::NAMESPACE_KEY});
foreach ($data as $string => $translated) {
$this->translator->setTranslation($string, $translated);
}
}
exit;
}
}
示例5: isMethod
/**
* @inheritdoc
*/
public function isMethod($method)
{
return $this->current->isMethod($method);
}