当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getInstance方法代码示例

本文整理汇总了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());
 }
开发者ID:bluzphp,项目名称:framework,代码行数:12,代码来源:GridTest.php

示例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');
    //   }
开发者ID:Kit-kat1,项目名称:bluz,代码行数:31,代码来源:upload.php

示例3: getRequest

 /**
  * Get Request instance
  *
  * @api
  * @return Http\Request
  */
 public function getRequest()
 {
     return Request::getInstance();
 }
开发者ID:Kit-kat1,项目名称:custom-bluz-app,代码行数:10,代码来源:Application.php

示例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);
 }
开发者ID:bluzphp,项目名称:framework,代码行数:15,代码来源:Router.php


注:本文中的Bluz\Proxy\Request::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。