本文整理汇总了PHP中Bluz\Proxy\Request::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getParams方法的具体用法?PHP Request::getParams怎么用?PHP Request::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bluz\Proxy\Request
的用法示例。
在下文中一共展示了Request::getParams方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParamManipulation
/**
* Test of params
*/
public function testParamManipulation()
{
Request::setParam('foo', 'bar');
Request::setParam('baz', 'qux');
$this->assertEquals('bar', Request::getParam('foo'));
$this->assertEquals('qux', Request::getParam('baz'));
$this->assertEquals('moo', Request::getParam('qux', 'moo'));
$this->assertEqualsArray(['foo' => 'bar', 'baz' => 'qux'], Request::getParams());
$this->assertEqualsArray(['foo' => 'bar', 'baz' => 'qux'], Request::getAllParams());
}
示例2: __construct
/**
* Prepare request for processing
*/
public function __construct()
{
// rewrite REST with "_method" param
// this is workaround
$this->method = strtoupper(Request::getParam('_method', Request::getMethod()));
// get all params
$query = Request::getQuery();
if (is_array($query) && !empty($query)) {
unset($query['_method']);
$this->params = $query;
}
$this->data = Request::getParams();
}
示例3: function
<?php
/**
*
*
* @category Application
*
* @author dark
* @created 18.12.13 18:39
*/
namespace Application;
use Bluz\Proxy\Request;
return function ($alias) use($module, $controller, $view) {
/**
* @var Bootstrap $this
* @var \Bluz\View\View $view
*/
var_dump($alias);
var_dump(Request::getParams());
var_dump(Request::getAllParams());
var_dump(Request::getRawParams());
return false;
};
示例4: function
* @param bool $checkAccess
* @return null|string
* @throws ViewException
*/
return function ($module, $controller, $params = [], $checkAccess = false) {
/**
* @var View $this
*/
try {
if ($checkAccess) {
try {
$controllerInstance = new Controller($module, $controller);
$controllerInstance->checkPrivilege();
} catch (ForbiddenException $e) {
return null;
}
}
} catch (\Exception $e) {
throw new ViewException('Url View Helper: ' . $e->getMessage());
}
if (null === $module) {
$module = Request::getModule();
}
if (null === $controller) {
$controller = Request::getController();
}
if (null === $params) {
$params = Request::getParams();
}
return Router::getUrl($module, $controller, $params);
};
示例5: doProcess
/**
* Do process
*
* @return void
*/
protected function doProcess()
{
$module = Request::getModule();
$controller = Request::getController();
$params = Request::getParams();
// try to dispatch controller
try {
// dispatch controller
$result = $this->dispatch($module, $controller, $params);
} catch (ForbiddenException $e) {
$result = $this->forbidden($e);
} catch (RedirectException $e) {
// redirect to URL
$result = $this->redirect($e->getUrl());
} catch (\Exception $e) {
$result = $this->error($e);
}
// setup layout, if needed
if ($this->useLayout()) {
// render view to layout
// needed for headScript and headStyle helpers
Layout::setContent($result->render());
Response::setBody(Layout::getInstance());
} else {
Response::setBody($result);
}
}
示例6: __construct
/**
* Prepare request for processing
*/
public function __construct()
{
// HTTP method
$method = Request::getMethod();
$this->method = strtoupper($method);
// get path
// %module% / %controller% / %id% / %relation% / %id%
$path = Router::getCleanUri();
$this->params = explode('/', rtrim($path, '/'));
// module
$this->module = array_shift($this->params);
// controller
$this->controller = array_shift($this->params);
$data = Request::getParams();
unset($data['_method'], $data['_module'], $data['_controller']);
$this->data = $data;
}