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


PHP HTTP::getFirstPathElement方法代碼示例

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


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

示例1: getBaseURL

 /**
  * Retrieve the absolute path of the SimpleSAMLphp installation, relative to the root of the website.
  *
  * For example: simplesaml/
  *
  * The path will always end with a '/' and never have a leading slash.
  *
  * @return string The absolute path relative to the root of the website.
  *
  * @throws SimpleSAML_Error_Exception If the format of 'baseurlpath' is incorrect.
  */
 public function getBaseURL()
 {
     $baseURL = $this->getString('baseurlpath', 'simplesaml/');
     if (preg_match('/^\\*(.*)$/D', $baseURL, $matches)) {
         // deprecated behaviour, will be removed in the future
         return \SimpleSAML\Utils\HTTP::getFirstPathElement(false) . $matches[1];
     }
     if (preg_match('#^https?://[^/]*/(.*)$#', $baseURL, $matches)) {
         // we have a full url, we need to strip the path
         return $matches[1];
     } elseif ($baseURL === '' || $baseURL === '/') {
         // Root directory of site
         return '';
     } elseif (preg_match('#^/?([^/]?.*/)#D', $baseURL, $matches)) {
         // local path only
         return $matches[1];
     } else {
         // invalid format
         throw new SimpleSAML_Error_Exception('Incorrect format for option \'baseurlpath\'. Value is: "' . $this->getString('baseurlpath', 'simplesaml/') . '". Valid format is in the form' . ' [(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/].');
     }
 }
開發者ID:mrvanes,項目名稱:simplesamlphp,代碼行數:32,代碼來源:Configuration.php

示例2: array

<?php

require_once '../_include.php';
/* Load simpleSAMLphp, configuration */
$config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getSessionFromRequest();
/* Check if valid local session exists.. */
SimpleSAML\Utils\Auth::requireAdmin();
$attributes = array();
$attributes['HTTP_HOST'] = array($_SERVER['HTTP_HOST']);
$attributes['HTTPS'] = isset($_SERVER['HTTPS']) ? array($_SERVER['HTTPS']) : array();
$attributes['SERVER_PROTOCOL'] = array($_SERVER['SERVER_PROTOCOL']);
$attributes['SERVER_PORT'] = array($_SERVER['SERVER_PORT']);
$attributes['Utilities_getBaseURL()'] = array(\SimpleSAML\Utils\HTTP::getBaseURL());
$attributes['Utilities_getSelfHost()'] = array(\SimpleSAML\Utils\HTTP::getSelfHost());
$attributes['Utilities_selfURLhost()'] = array(\SimpleSAML\Utils\HTTP::getSelfURLHost());
$attributes['Utilities_selfURLNoQuery()'] = array(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery());
$attributes['Utilities_getSelfHostWithPath()'] = array(\SimpleSAML\Utils\HTTP::getSelfHostWithPath());
$attributes['Utilities_getFirstPathElement()'] = array(\SimpleSAML\Utils\HTTP::getFirstPathElement());
$attributes['Utilities_selfURL()'] = array(\SimpleSAML\Utils\HTTP::getSelfURL());
$template = new SimpleSAML_XHTML_Template($config, 'hostnames.php');
$template->data['remaining'] = $session->getAuthData('admin', 'Expire') - time();
$template->data['attributes'] = $attributes;
$template->data['valid'] = 'na';
$template->data['logout'] = null;
$template->show();
開發者ID:tractorcow,項目名稱:simplesamlphp,代碼行數:26,代碼來源:hostnames.php

示例3: getFirstPathElement

 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getFirstPathElement() instead.
  */
 public static function getFirstPathElement($trailingslash = true)
 {
     return \SimpleSAML\Utils\HTTP::getFirstPathElement($trailingslash);
 }
開發者ID:jstormes,項目名稱:simplesamlphp,代碼行數:7,代碼來源:Utilities.php

示例4: getBaseURL

 /**
  * Retrieve the absolute path of the SimpleSAMLphp installation, relative to the root of the website.
  *
  * For example: simplesaml/
  *
  * The path will always end with a '/' and never have a leading slash.
  *
  * @return string The absolute path relative to the root of the website.
  *
  * @throws SimpleSAML\Error\CriticalConfigurationError If the format of 'baseurlpath' is incorrect.
  *
  * @deprecated This method will be removed in SimpleSAMLphp 2.0. Please use getBasePath() instead.
  */
 public function getBaseURL()
 {
     if (!$this->deprecated_base_url_used) {
         $this->deprecated_base_url_used = true;
         SimpleSAML\Logger::warning("SimpleSAML_Configuration::getBaseURL() is deprecated, please use getBasePath() instead.");
     }
     if (preg_match('/^\\*(.*)$/D', $this->getString('baseurlpath', 'simplesaml/'), $matches)) {
         // deprecated behaviour, will be removed in the future
         return \SimpleSAML\Utils\HTTP::getFirstPathElement(false) . $matches[1];
     }
     return ltrim($this->getBasePath(), '/');
 }
開發者ID:simplesamlphp,項目名稱:simplesamlphp,代碼行數:25,代碼來源:Configuration.php


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