當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::isGet方法代碼示例

本文整理匯總了PHP中Slim\Http\Request::isGet方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::isGet方法的具體用法?PHP Request::isGet怎麽用?PHP Request::isGet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Slim\Http\Request的用法示例。


在下文中一共展示了Request::isGet方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __invoke

 public function __invoke(Request $req, Response $res, callable $next)
 {
     $map = function ($value) {
         return ['value' => $value, 'label' => $value];
     };
     if ($req->isGet()) {
         $this->view['tpe_survey'] = ['already_using_tpe' => self::$alreadyUsingTpe, 'knowledge_levels' => array_map($map, self::$knowledgeLevels), 'assets_in_use' => array_map($map, self::$assetsInUse), 'software_in_use' => self::$softwareInUse, 'use_case' => self::$useCase];
     }
     return $next($req, $res);
 }
開發者ID:eellak,項目名稱:gredu_labs,代碼行數:10,代碼來源:SurveyFormDefaults.php

示例2: authorizeSkillRoute

 public function authorizeSkillRoute(Request $request, Response $response, callable $next)
 {
     // Authorize portfolio middleware
     $args = $request->getAttribute('routeInfo')[2];
     if (!$args || $request->isXhr() && $request->isGet()) {
         return $next($request, $response);
     }
     $count = $this->data(Models\MemberSkills::class)->count(['member_skill_id' => (int) $args['id'], 'user_id' => $this->session->get('user_id')]);
     if ($count < 1) {
         $this->flash->addMessage('warning', 'Permission denied.');
         return $response->withRedirect($this->router->pathFor('membership-account'));
     }
     return $next($request, $response);
 }
開發者ID:phpindonesia,項目名稱:phpindonesia.or.id-membership2,代碼行數:14,代碼來源:Middleware.php

示例3: isAcceptable

 /**
  * @param \Slim\Http\Request $request
  * @return bool
  */
 private function isAcceptable(Request $request)
 {
     $args = $request->getAttribute('routeInfo')[2];
     return !$args || $request->isXhr() && $request->isGet();
 }
開發者ID:aswitahidayat,項目名稱:phpindonesia.or.id-membership2,代碼行數:9,代碼來源:Middleware.php

示例4: isGet

 protected function isGet()
 {
     return $this->request->isGet();
 }
開發者ID:benconnito,項目名稱:kopper,代碼行數:4,代碼來源:Controller.php

示例5: video

 /**
  * Dislay information about the video.
  *
  * @param Request  $request  PSR-7 request
  * @param Response $response PSR-7 response
  *
  * @return Response HTTP response
  */
 public function video(Request $request, Response $response)
 {
     $params = $request->getQueryParams();
     $this->config = Config::getInstance();
     if (isset($params['url'])) {
         if (isset($params['audio'])) {
             try {
                 $url = $this->download->getURL($params['url'], 'mp3[protocol^=http]');
                 return $response->withRedirect($url);
             } catch (\Exception $e) {
                 $response = $response->withHeader('Content-Disposition', 'attachment; filename="' . $this->download->getAudioFilename($params['url'], 'bestaudio/best') . '"');
                 $response = $response->withHeader('Content-Type', 'audio/mpeg');
                 if ($request->isGet()) {
                     $process = $this->download->getAudioStream($params['url'], 'bestaudio/best');
                     $response = $response->withBody(new Stream($process));
                 }
                 return $response;
             }
         } else {
             $video = $this->download->getJSON($params['url']);
             if ($this->container instanceof Container) {
                 $this->container->view->render($response, 'video.tpl', ['video' => $video, 'class' => 'video', 'title' => $video->title, 'description' => 'Download "' . $video->title . '" from ' . $video->extractor_key]);
             }
         }
     } else {
         return $response->withRedirect($this->container->get('router')->pathFor('index'));
     }
 }
開發者ID:rudloff,項目名稱:alltube,代碼行數:36,代碼來源:FrontController.php


注:本文中的Slim\Http\Request::isGet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。