本文整理汇总了PHP中Slim\Http\Request::params方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::params方法的具体用法?PHP Request::params怎么用?PHP Request::params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Http\Request
的用法示例。
在下文中一共展示了Request::params方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildParams
private function buildParams(array $params = array())
{
$body = $this->request->getBody();
if (is_array($body) === false) {
$body = array();
}
if (array_key_exists(0, $body) === true) {
$body = array(self::PARAM_REQUEST_BODY => $body);
}
return array_replace($this->request->params(), $body, $params);
}
示例2: get
/**
*
* @return
*/
public function get()
{
// Disable strictness on model
$this->model->setStrict(BaseSchema::STRICT_NONE);
// handle stubs, if requested
if ($this->request->params('stub')) {
$data = $this->model->stub($this->request->params('stubType'));
foreach ($data as $key => $row) {
$data[$key] = $this->model->filter($row);
}
return $this->model->filter($data);
}
// parse the query string
$this->parseQueryString();
// Extract the data from the parseResult.
// Set as separate methods so that subclasses can selectively
// override
$conditions = $this->getFindConditions();
$fields = $this->getFindFields();
$sort = $this->getFindSort();
$limit = $this->getFindLimit();
$skip = $this->getFindSkip();
$misc = $this->getFindMisc();
$field = $this->request->params('distinctCount');
// a field name
if ($field) {
return $this->handleDistinctCount($field, $conditions, $misc);
}
$findResult = $this->model->find($conditions, $fields, $sort, $limit, $skip, $misc);
$metaResult = [];
if ($this->request->params('count')) {
$metaResult['_meta']['count'] = $this->model->count($conditions);
}
// Pass to model for processing
return array_merge($findResult, $metaResult);
}
示例3: bind
/**
* Bind a request
*
* @param Request $request Request
*
* @return array
*/
public function bind(Request $request)
{
$params = array('rotate' => $request->params('r'), 'negate' => $request->params('n'), 'crop' => false, 'contrast' => $request->params('c'), 'brightness' => $request->params('b'));
if ($request->params('h') !== null && $request->params('w') !== null && $request->params('x') !== null && $request->params('y') !== null) {
$params['crop'] = array('x' => $request->params('x'), 'y' => $request->params('y'), 'w' => $request->params('w'), 'h' => $request->params('h'));
}
return $params;
}
示例4: _getAction
private function _getAction(Request $request)
{
$text = $request->params('text');
$matches = explode(" ", $text);
return "action" . $matches[1];
}