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