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


PHP SimpleUrl::getUsername方法代碼示例

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


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

示例1: addHeaders

 /**
  *    Presents the appropriate headers for this location.
  *    @param SimpleHttpRequest $request  Request to modify.
  *    @param SimpleUrl $url              Base of realm.
  *    @access public
  */
 function addHeaders($request, $url)
 {
     if ($url->getUsername() && $url->getPassword()) {
         $username = $url->getUsername();
         $password = $url->getPassword();
     } elseif ($realm = $this->findRealmFromUrl($url)) {
         $username = $realm->getUsername();
         $password = $realm->getPassword();
     } else {
         return;
     }
     $this->addBasicHeaders($request, $username, $password);
 }
開發者ID:GerHobbelt,項目名稱:simpletest,代碼行數:19,代碼來源:authentication.php

示例2: assertUrl

 function assertUrl($raw, $parts, $params = false)
 {
     if (!is_array($params)) {
         $params = array();
     }
     $url = new SimpleUrl($raw);
     $this->assertIdentical($url->getScheme(), $parts[0], "[{$raw}] scheme->%s");
     $this->assertIdentical($url->getUsername(), $parts[1], "[{$raw}] username->%s");
     $this->assertIdentical($url->getPassword(), $parts[2], "[{$raw}] password->%s");
     $this->assertIdentical($url->getHost(), $parts[3], "[{$raw}] host->%s");
     $this->assertIdentical($url->getPort(), $parts[4], "[{$raw}] port->%s");
     $this->assertIdentical($url->getPath(), $parts[5], "[{$raw}] path->%s");
     $this->assertIdentical($url->getTld(), $parts[6], "[{$raw}] tld->%s");
     $this->assertIdentical($url->getEncodedRequest(), $parts[7], "[{$raw}] encoded->%s");
     $query = new SimpleQueryString();
     foreach ($params as $key => $value) {
         $query->add($key, $value);
     }
     $this->assertIdentical($url->getRequest(), $query, "[{$raw}] request->%s");
     $this->assertIdentical($url->getFragment(), $parts[8], "[{$raw}] fragment->%s");
 }
開發者ID:BackupTheBerlios,項目名稱:limb-svn,代碼行數:21,代碼來源:http_test.php

示例3: assertUrl

 function assertUrl($raw, $parts, $params = false, $coords = false)
 {
     if (!is_array($params)) {
         $params = array();
     }
     $url = new SimpleUrl($raw);
     $this->assertIdentical($url->getScheme(), $parts[0], "[{$raw}] scheme -> %s");
     $this->assertIdentical($url->getUsername(), $parts[1], "[{$raw}] username -> %s");
     $this->assertIdentical($url->getPassword(), $parts[2], "[{$raw}] password -> %s");
     $this->assertIdentical($url->getHost(), $parts[3], "[{$raw}] host -> %s");
     $this->assertIdentical($url->getPort(), $parts[4], "[{$raw}] port -> %s");
     $this->assertIdentical($url->getPath(), $parts[5], "[{$raw}] path -> %s");
     $this->assertIdentical($url->getTld(), $parts[6], "[{$raw}] tld -> %s");
     $this->assertIdentical($url->getEncodedRequest(), $parts[7], "[{$raw}] encoded -> %s");
     $this->assertIdentical($url->getFragment(), $parts[8], "[{$raw}] fragment -> %s");
     if ($coords) {
         $this->assertIdentical($url->getX(), $coords[0], "[{$raw}] x -> %s");
         $this->assertIdentical($url->getY(), $coords[1], "[{$raw}] y -> %s");
     }
 }
開發者ID:PublicityPort,項目名稱:OpenCATS,代碼行數:20,代碼來源:url_test.php

示例4: testUsernameAndPasswordInUTF8

 public function testUsernameAndPasswordInUTF8()
 {
     $url = new SimpleUrl('http://pÈrick:penËt@www.lastcraft.com');
     $this->assertEqual($url->getUsername(), 'pÈrick');
     $this->assertEqual($url->getPassword(), 'penËt');
 }
開發者ID:guicara,項目名稱:simpletest,代碼行數:6,代碼來源:utf8_test.php


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