本文整理汇总了PHP中Bluz\Proxy\Request::setRawParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setRawParams方法的具体用法?PHP Request::setRawParams怎么用?PHP Request::setRawParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bluz\Proxy\Request
的用法示例。
在下文中一共展示了Request::setRawParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOptionsOne
/**
* OPTIONS request should set Allow header
*/
public function testOptionsOne()
{
Request::setMethod(Request::METHOD_OPTIONS);
Request::setRawParams([100042]);
$this->processRest();
$this->assertEquals('HEAD,OPTIONS,GET,PATCH,PUT,DELETE', Response::getHeader('Allow'));
}
示例2: processRoute
/**
* Process router by default rules
*
* Default routers examples
* /
* /:module/
* /:module/:controller/
* /:module/:controller/:key1/:value1/:key2/:value2...
*
* @return bool
*/
protected function processRoute()
{
$uri = Request::getCleanUri();
$uri = trim($uri, '/');
$params = explode('/', $uri);
if (sizeof($params)) {
Request::setModule(array_shift($params));
}
if (sizeof($params)) {
Request::setController(array_shift($params));
}
if ($size = sizeof($params)) {
// save raw params
Request::setRawParams($params);
// remove tail
if ($size % 2 == 1) {
array_pop($params);
$size = sizeof($params);
}
// or use array_chunk and run another loop?
for ($i = 0; $i < $size; $i = $i + 2) {
Request::setParam($params[$i], $params[$i + 1]);
}
}
return true;
}
示例3: function
*/
namespace Application;
use Application\Auth\Table;
use Bluz\Proxy\Auth;
use Bluz\Proxy\Request;
return function ($resource, $id, $relation, $relationId) {
/**
* @var Bootstrap $this
*/
$this->useJson();
Auth::clearIdentity();
try {
// authentication
if ($token = $this->getRequest()->getParam('token')) {
Table::getInstance()->authenticateToken($token);
}
$params = [];
foreach ([$id, $relation, $relationId] as $param) {
if (!is_null($param)) {
$params[] = $param;
}
}
Request::setRawParams($params);
return $this->dispatch('api', $resource);
} catch (\Exception $e) {
// process exceptions here
$this->getResponse()->setStatusCode($e->getCode());
return (object) ['error' => $e->getMessage()];
}
};