本文整理匯總了PHP中Psr\Http\Message\ServerRequestInterface::withMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP ServerRequestInterface::withMethod方法的具體用法?PHP ServerRequestInterface::withMethod怎麽用?PHP ServerRequestInterface::withMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Psr\Http\Message\ServerRequestInterface
的用法示例。
在下文中一共展示了ServerRequestInterface::withMethod方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct(Request $request, Response $response, DB $db)
{
$this->request = $request;
$this->response = $response;
$this->db = $db;
if (!$request->withMethod('POST')) {
die('Not allowed');
}
}
示例2: withMethod
/**
* {@inheritdoc}
*/
public function withMethod($method)
{
return new static($this->wrapped->withMethod($method));
}
示例3: withMethod
/**
* {@inheritDoc}
*/
public function withMethod($method)
{
return new self($this->app, $this->psrRequest->withMethod($method));
}
示例4: withMethod
/**
* Proxy to ServerRequestInterface::withMethod()
*
* {@inheritdoc}
*/
public function withMethod($method)
{
$new = $this->psrRequest->withMethod($method);
return new self($new, $this->originalRequest);
}
示例5: withMethod
/**
* @inheritDoc
*/
public function withMethod($method)
{
$self = clone $this;
$self->serverRequest = $this->serverRequest->withMethod($method);
return $self;
}
示例6: applyVirtualMethod
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
* @return \Psr\Http\Message\ServerRequestInterface
*/
protected function applyVirtualMethod(ServerRequestInterface $request)
{
if (!$this->config->isVirtualMethodEnabled()) {
return $request;
}
$parsedBody = $request->getParsedBody();
if (!isset($parsedBody['_method'])) {
return $request;
}
return $request->withMethod(strtoupper($parsedBody['_method']));
}