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


PHP Url::getQueryParameter方法代碼示例

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


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

示例1: getVideoByUrl

 /**
  * Fetches video data by youtube url
  * @param  string  $videoUrl YouTube url
  * @return Video
  */
 public function getVideoByUrl($videoUrl)
 {
     $url = new Nette\Http\Url($videoUrl);
     if (stripos($url->host, 'youtu.be') !== false) {
         return $this->getVideo(trim($url->getPath(), '/'));
     }
     $videoId = $url->getQueryParameter('v');
     if (stripos($url->host, 'youtube.com') === false || $videoId === null) {
         throw new Nette\InvalidArgumentException('videoUrl must be valid youtube url.');
     }
     return $this->getVideo($videoId);
 }
開發者ID:nextras,項目名稱:youtube-api,代碼行數:17,代碼來源:Reader.php

示例2: createFileRoute

 private function createFileRoute(array $route)
 {
     $web = $route['metadata']['web'][Nette\Application\Routers\Route::VALUE];
     unset($route['metadata']['web']);
     return new Nette\Application\Routers\Route(...array_values(array_merge_recursive(['mask' => self::FILE_MASK] + $route, ['metadata' => ['file' => [Nette\Application\Routers\Route::PATTERN => '[a-z0-9.-/]+'], NULL => [Nette\Application\Routers\Route::FILTER_IN => function (array $params) {
         $webDir = implode(DIRECTORY_SEPARATOR, [$this->wwwDir, 'web', $params['web']]);
         $domainDir = implode(DIRECTORY_SEPARATOR, [$webDir, 'domain', $domain = $params['domain']]);
         $webFile = implode(DIRECTORY_SEPARATOR, [$webDir, $file = $params['file']]);
         $domainFile = implode(DIRECTORY_SEPARATOR, [$domainDir, $file]);
         if (is_file($domainFile)) {
             $params['webDomain'] = $domain;
         } elseif (!is_file($webFile)) {
             return NULL;
         }
         return $params;
     }, Nette\Application\Routers\Route::FILTER_OUT => function (array $params) use($web) {
         if (!isset($params['file']) || !($file = $params['file'])) {
             return NULL;
         }
         $webDir = implode(DIRECTORY_SEPARATOR, [$this->wwwDir, 'web', $params['web'] = $web]);
         $webFile = implode(DIRECTORY_SEPARATOR, [$webDir, $file]);
         $domainDir = implode(DIRECTORY_SEPARATOR, [$webDir, 'domain', $domain = $params['domain']]);
         $domainFile = implode(DIRECTORY_SEPARATOR, [$domainDir, $file]);
         $directory = NULL;
         if (is_file($domainFile)) {
             $params['webDomain'] = $domain;
             $directory = $domainDir;
         } elseif (is_file($webFile)) {
             $directory = $webDir;
         } else {
             unset($params['web']);
             $directory = $this->wwwDir;
         }
         if ((!isset($params['version']) || $params['version']) && $directory) {
             $url = new Nette\Http\Url(call_user_func($this->versionFilter, $file, $directory, $parameter = is_string($params['version'] ?? NULL) ? $params['version'] : 'version'));
             $params['version'] = $url->getQueryParameter($parameter);
         } else {
             unset($params['version']);
         }
         return array_intersect_key($params, array_flip(['domain', 'web', 'webDomain', 'file', 'version']));
     }]]])));
 }
開發者ID:ytnuk,項目名稱:web,代碼行數:42,代碼來源:Factory.php


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