本文整理汇总了PHP中Psr\Http\Message\ServerRequestInterface::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP ServerRequestInterface::getParams方法的具体用法?PHP ServerRequestInterface::getParams怎么用?PHP ServerRequestInterface::getParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Http\Message\ServerRequestInterface
的用法示例。
在下文中一共展示了ServerRequestInterface::getParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @param array $args
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function getAll(Request $request, Response $response, $args)
{
$this->logger->info(substr(strrchr(rtrim(__CLASS__, '\\'), '\\'), 1) . ': ' . __FUNCTION__);
$path = explode('/', $request->getUri()->getPath())[1];
$arrparams = $request->getParams();
return $response->write(json_encode($this->dataaccess->getAll($path, $arrparams)));
}
示例2: __invoke
/**
* Validation middleware invokable class.
*
* @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request
* @param \Psr\Http\Message\ResponseInterface $response PSR7 response
* @param callable $next Next middleware
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function __invoke($request, $response, $next)
{
$this->errors = [];
$params = $request->getParams();
$this->validate($params, $this->validators);
return $next($request, $response);
}
示例3: getParams
/**
* Get the original parameters of the request.
*
* @return array
*/
protected function getParams()
{
if (method_exists($this->request, 'getParams')) {
return $this->request->getParams();
}
return array();
}