本文整理匯總了PHP中Bluz\Proxy\Request::setParams方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::setParams方法的具體用法?PHP Request::setParams怎麽用?PHP Request::setParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bluz\Proxy\Request
的用法示例。
在下文中一共展示了Request::setParams方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareRequest
/**
* prepareRequest
*
* @param string $uri in format "module/controllers"
* @param array $params of request
* @param string $method HTTP
* @param bool $ajax
* @return Http\Request
*/
private function prepareRequest($uri, array $params = null, $method = Http\Request::METHOD_GET, $ajax = false)
{
Request::setRequestUri($uri);
Request::setOptions(Config::getData('request'));
Request::setMethod($method);
// process $_GET params
if ($query = stristr($uri, '?')) {
$query = substr($query, 1);
// remove `?` sign
parse_str($query, $_GET);
// fill $_GET
}
// process custom params
if ($params) {
Request::setParams($params);
}
if ($ajax) {
$_SERVER['HTTP_ACCEPT'] = 'application/json';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
} else {
$_SERVER['HTTP_ACCEPT'] = 'text/html';
}
}
示例2: testDeleteSet
/**
* DELETE request with SET of DATA should DELETE SET but not implemented yet
* @expectedException \Bluz\Application\Exception\NotImplementedException
*/
public function testDeleteSet()
{
Request::setMethod(Request::METHOD_DELETE);
Request::setParams([['id' => 3], ['id' => 4]]);
$this->processRest();
}
示例3: testDeleteError
/**
* DELETE request with invalid id should return ERROR
* @expectedException \Bluz\Application\Exception\NotFoundException
*/
public function testDeleteError()
{
Request::setMethod(Request::METHOD_DELETE);
Request::setParams(['id' => 100042]);
$this->processCrud();
}