本文整理汇总了PHP中Bluz\Proxy\Request::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getInstance方法的具体用法?PHP Request::getInstance怎么用?PHP Request::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bluz\Proxy\Request
的用法示例。
在下文中一共展示了Request::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProcessRequest
/**
* Process Request
*/
public function testProcessRequest()
{
$request = Request::getInstance();
$request = $request->withQueryParams(['arr-page' => 2, 'arr-limit' => 2, 'arr-order-id' => 'desc', 'arr-filter-name' => 'ne-Smith', 'arr-filter-status' => 'disable']);
Request::setInstance($request);
$grid = new ArrayGrid();
$this->assertEquals(8, $grid->total());
$this->assertEquals(4, $grid->pages());
}
示例2: function
* description = "Upload images",
* required = true,
* type="File"
* ),
* @SWG\ResponseMessage(code=400, message="Invalid file type"),
* @SWG\ResponseMessage(code=200, message="File was uploaded")
* )
* )
*/
return function () {
/**
* @var Bootstrap $this
*/
/** @var \Bluz\Http\File $file */
//if (Request::getFileUpload()->getFile('files')->getType() == 'image') {
if (Request::getInstance()->isPost()) {
$upload = new Musician\Upload();
$path = Config::getModuleData('musician', 'upload_path');
if (empty($path)) {
throw new Exception('Upload_path is not configured');
}
$upload->setUploadDir($path . "/musician");
$file = $upload->upload();
$url = "/uploads/musician/" . $file->getFullName();
return ['fullName' => $file->getFullName(), 'url' => $url];
} else {
return [];
}
// } else {
// throw new Exception('Invalid file type');
// }
示例3: getRequest
/**
* Get Request instance
*
* @api
* @return Http\Request
*/
public function getRequest()
{
return Request::getInstance();
}
示例4: resetRequest
/**
* Reset Request
*
* @return void
*/
protected function resetRequest()
{
$request = Request::getInstance();
// priority:
// - default values
// - from GET query
// - from path
$request = $request->withQueryParams(array_merge(['_module' => $this->getDefaultModule(), '_controller' => $this->getDefaultController()], $request->getQueryParams(), $this->params));
Request::setInstance($request);
}