當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。