本文整理匯總了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();
}