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


PHP Request::get方法代码示例

本文整理汇总了PHP中yii\web\Request::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::get方法的具体用法?PHP Request::get怎么用?PHP Request::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\web\Request的用法示例。


在下文中一共展示了Request::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNoteAuthorId

 /**
  * @param \yii\web\Request $request
  * @return integer|null
  */
 private function getNoteAuthorId($request)
 {
     $noteId = $request->get('id');
     /** @var $note Note|null */
     $note = Note::findOne($noteId);
     return isset($note) ? $note->author_id : null;
 }
开发者ID:jslight,项目名称:helpdesk,代码行数:11,代码来源:AuthorRule.php

示例2: respondByJsonFormat

 /**
  * 输出json
  */
 protected function respondByJsonFormat()
 {
     headers_sent() or header('Content-Type: application/json; charset=utf-8');
     $response = json_encode($this->responseData, $this->getJsonEncodeOptions());
     if ('' != ($callback = $this->request->get('callback'))) {
         $response = $callback . '(' . $response . ');';
     }
     echo $response;
     $this->end();
 }
开发者ID:heartshare,项目名称:yii2-liuxy-extension,代码行数:13,代码来源:WebController.php

示例3: getRouteFromSlug

 /**
  * @param \yii\web\Request $request
  * @return string
  */
 public function getRouteFromSlug($request)
 {
     $_route = $request->getPathInfo();
     $_params = $request->get();
     $dbRoute = $this->getRouteFromCacheOrWriteCacheThenRead($_route, $_params);
     if (is_object($dbRoute) && $dbRoute->hasAttribute('redirect')) {
         if ($dbRoute->getAttribute('redirect')) {
             Yii::$app->response->redirect([$dbRoute->slug], $dbRoute->getAttribute('redirect_code'));
         }
     }
     return $_route;
 }
开发者ID:fg,项目名称:yii2-url-alias,代码行数:16,代码来源:UrlRule.php

示例4: actionView

 /**
  * Displays product category page.
  *
  * @param string $path
  * @param Request $request
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionView($path, Request $request)
 {
     $model = $this->findModel($path);
     $this->setModel($model);
     $categorySearchComponent = $this->getCategorySearchComponent();
     $searchableType = 'product';
     $searchQuery = $request->get('query', null);
     $params['categoriesFacetValueRouteParams'] = function (CategoriesFacetValue $value) {
         return ['path' => $value->getEntity()->slug];
     };
     $dataProvider = $categorySearchComponent->getSearchDataProvider($searchableType, $model, $searchQuery, $params);
     $dataProvider->prepare();
     $this->_searchResult = $dataProvider->query->result();
     return $this->render('view', ['model' => $model, 'productsDataProvider' => $dataProvider]);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:23,代码来源:ProductCategoryController.php

示例5: actionView

 public function actionView($path, Request $request)
 {
     $model = $this->findModel($path);
     /** @var \im\search\components\SearchManager $searchManager */
     $searchManager = Yii::$app->get('searchManager');
     $query = $request->get('query', '');
     $searchComponent = $searchManager->getSearchComponent();
     /** @var FacetSet $facetSet */
     $facetSet = FacetSet::findOne(1);
     $facets = $facetSet->facets;
     $query = $searchComponent->getQuery('product', $query, $facets);
     $dataProvider = new SearchDataProvider(['query' => $query]);
     $dataProvider->prepare();
     $this->_searchResult = $dataProvider->query->result();
     return $this->render('view', ['model' => $model, 'dataProvider' => $dataProvider]);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:16,代码来源:SearchPageController.php

示例6: receive

 /**
  * @param Request $request
  * @return bool
  */
 public function receive(Request $request)
 {
     $this->answer = null;
     $model = new IncomingRequest();
     if ($model->load($request->get(), '') && $model->validate()) {
         $this->sms = $model->toIncomingSms();
         $this->sms->save(false);
         $this->trigger(self::EVENT_RECEIVE_SMS);
         $this->sms->updateAttributes(['answer' => $this->answer]);
         $this->isError = false;
         return $this;
     }
     $this->trigger(self::EVENT_ERROR);
     $this->isError = true;
     return $this;
 }
开发者ID:omnilight,项目名称:yii2-sms-receive,代码行数:20,代码来源:SmsOnlineProvider.php

示例7: populateForm

 public function populateForm(Request $request)
 {
     $form = $this->makeForm($request->get('formId'));
     $fields = $form->getFields();
     foreach ($request->get() as $name => $value) {
         $fields[$name]->setValue($value);
     }
     $this->saveForm($form);
 }
开发者ID:ouk,项目名称:forms,代码行数:9,代码来源:FormManager.php

示例8: negotiateLanguage

 /**
  * Negotiates the application language.
  * @param Request $request
  * @return string the chosen language
  */
 protected function negotiateLanguage($request)
 {
     if (!empty($this->languageParam) && ($language = $request->get($this->languageParam)) !== null) {
         if (isset($this->languages[$language])) {
             return $this->languages[$language];
         }
         foreach ($this->languages as $key => $supported) {
             if (is_integer($key) && $this->isLanguageSupported($language, $supported)) {
                 return $supported;
             }
         }
         return reset($this->languages);
     }
     foreach ($request->getAcceptableLanguages() as $language) {
         if (isset($this->languages[$language])) {
             return $this->languages[$language];
         }
         foreach ($this->languages as $key => $supported) {
             if (is_integer($key) && $this->isLanguageSupported($language, $supported)) {
                 return $supported;
             }
         }
     }
     return reset($this->languages);
 }
开发者ID:pathman,项目名称:yii2comm,代码行数:30,代码来源:ContentNegotiator.php

示例9: actionManager

 public function actionManager(Request $request)
 {
     return $this->renderFile(__DIR__ . '/views/manager.php', ['options' => $this->getManagerOptions($request->get())]);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:4,代码来源:ElFinderController.php


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