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


PHP Request::isGet方法代码示例

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


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

示例1: TreatRequest

 public function TreatRequest()
 {
     $request = new Request();
     if ($request->isGet()) {
         $this->DoGet();
     } else {
         if ($request->isPost()) {
             $this->DoPost();
         } else {
             return new \Exception();
         }
     }
 }
开发者ID:CrunchyArtie,项目名称:Audio,代码行数:13,代码来源:AudioWebServices.php

示例2: TreatRequest

 public function TreatRequest()
 {
     $req = new Request();
     if ($req->isGet()) {
         return $this->DoGet();
     }
     if ($req->isDelete() && $this->IsAuthorized()) {
         return $this->DoDelete();
     } else {
         if ($req->isPost()) {
             return $this->DoPost();
         } else {
             return new \Exception();
         }
     }
 }
开发者ID:CrunchyArtie,项目名称:Audio,代码行数:16,代码来源:LoginWebServices.php

示例3: selectSite

 /**
  * 
  * {@inheritDoc}
  */
 public function selectSite(Request $request, Response $response)
 {
     if (!$request->isGet()) {
         return false;
     }
     $siteId = $request->getQuery('siteId', self::ENGLISH_SITE_ID);
     $site = $this->siteService->find($siteId);
     if (!$site) {
         $siteId = self::ENGLISH_SITE_ID;
     }
     // Just in case
     $this->siteId = $siteId;
     $cookie = new SetCookie(self::SITE_ID_COOKIE, $siteId, time() + 30 * 24 * 60 * 60);
     // now + 1 month
     $response->getHeaders()->addHeader($cookie);
     return true;
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:21,代码来源:UtilityService.php

示例4: Edit

 public function Edit()
 {
     if (CommonController::IsAuthentified()) {
         $request = new Request();
         if ($request->isGet()) {
             $data = json_decode($this->GetCurrentCollection(), true);
             if (!is_null($data)) {
                 CommonController::SetView("collection", "edit", array_merge($data, array('url' => array('edit' => CommonController::GetLink("Collection", "edit", $data['collection']['id'])))));
                 return;
             }
         } else {
             if ($request->isPost()) {
                 $label = $request->getPost('label');
                 $description = $request->getPost('description');
                 $id = $request->getPost('id');
                 if (!is_null($label) && !is_null($description)) {
                     if (!is_null($id)) {
                         $WSCtrl = new WebServicesController();
                         $return = $WSCtrl->Call("Collection", "POST", array("id" => $id, "label" => $label, "description" => $description));
                         var_dump($return);
                         if ($return == "true") {
                             CommonController::Redirect("Collection", "Index", $id);
                         } else {
                             $data = json_decode($this->GetCurrentCollection(), true);
                             if (!is_null($data)) {
                                 CommonController::SetView("collection", "index", array_merge($data, array('url' => array('edit' => CommonController::GetLink("Collection", "edit", $data['collection']['id']), 'delete' => CommonController::GetLink("Collection", "delete", $data['collection']['id'])), 'error' => 'Impossible de sauver la collection')));
                                 return;
                             }
                         }
                     } else {
                         //Create
                     }
                 }
             }
         }
     }
     CommonController::Redirect("home");
 }
开发者ID:CrunchyArtie,项目名称:Audio,代码行数:38,代码来源:CollectionController.php

示例5: TreatRequest

 public function TreatRequest()
 {
     if ($this->IsAuthorized()) {
         $request = new Request();
         if ($request->isGet()) {
             return $this->DoGet();
         } else {
             if ($request->isPost()) {
                 return $this->DoPost();
             } else {
                 if ($request->isPut()) {
                     return $this->DoPut();
                 } else {
                     if ($request->isDelete()) {
                         return $this->DoDelete();
                     }
                 }
             }
         }
     } else {
         throw new \Exception();
     }
 }
开发者ID:CrunchyArtie,项目名称:Audio,代码行数:23,代码来源:UserWebServices.php

示例6: Request

 /**
  * Validates a token.
  *
  * Automatically validates a token when a request has an header with authorization.
  *
  * @since 4.3.0
  *
  * @return int|false user-id when token is valid, false when it is invalid.
  */
 function validate_token()
 {
     $request = new Request();
     if ($request->isGet() || $request->isPost()) {
         $authHeader = $request->getHeader('authorization');
         if ($authHeader) {
             list($jwt) = sscanf($authHeader->toString(), 'Authorization: Bearer %s');
             if ($jwt) {
                 try {
                     $secretKey = base64_decode(get_option('jwt_secret'));
                     $token = JWT::decode($jwt, $secretKey, array('HS256'));
                     return $token->data->userId;
                 } catch (Exception $e) {
                     // FALSE if token is invalid
                     return false;
                 }
             } else {
                 //  FALSE if no token was passed
                 return false;
             }
         }
     }
     return false;
 }
开发者ID:YanikPei,项目名称:wp-jwt-authentication,代码行数:33,代码来源:class-wak-functions.php

示例7: Request

<?php

chdir(dirname(__DIR__));
require_once 'vendor/autoload.php';
use Zend\Config\Config;
use Zend\Config\Factory;
use Zend\Http\PhpEnvironment\Request;
/*
 * Get all headers from the HTTP request
 */
$request = new Request();
if ($request->isGet()) {
    $authHeader = $request->getHeader('authorization');
    /*
     * Look for the 'authorization' header
     */
    if ($authHeader) {
        /*
         * Extract the jwt from the Bearer
         */
        list($jwt) = sscanf($authHeader->toString(), 'Authorization: Bearer %s');
        if ($jwt) {
            try {
                $config = Factory::fromFile('config/config.php', true);
                /*
                 * decode the jwt using the key from config
                 */
                $secretKey = base64_decode($config->get('jwt')->get('key'));
                $token = JWT::decode($jwt, $secretKey, [$config->get('jwt')->get('algorithm')]);
                $asset = base64_encode(file_get_contents('http://lorempixel.com/200/300/cats/'));
                /*
开发者ID:Kogonuso,项目名称:sp-simple-jwt,代码行数:31,代码来源:resource.php


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