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


PHP Net_URL2::getUserinfo方法代码示例

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


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

示例1: testNoUserinfoAndNormalize

 /**
  * Tests an URL with no userinfo and normalization
  *
  * Also: Regression test for Bug #20385
  *
  * @covers Net_URL2::getUserinfo
  * @covers Net_URL2::normalize
  * @covers Net_URL2::getNormalizedURL
  * @return void
  * @link https://pear.php.net/bugs/bug.php?id=20385
  */
 public function testNoUserinfoAndNormalize()
 {
     $testUrl = 'http://www.example.com/';
     $url = new Net_URL2($testUrl);
     $this->assertFalse($url->getUserinfo());
     $url->normalize();
     $this->assertFalse($url->getUserinfo());
     $this->assertEquals($testUrl, $url->getURL());
     $this->assertEquals($testUrl, $url->getNormalizedURL());
 }
开发者ID:rafalwojciechowski,项目名称:news,代码行数:21,代码来源:URL2Test.php

示例2: setUrl

 /**
  * Sets the URL for this request
  *
  * If the URL has userinfo part (username & password) these will be removed
  * and converted to auth data. If the URL does not have a path component,
  * that will be set to '/'.
  *
  * @param string|Net_URL2 $url Request URL
  *
  * @return   HTTP_Request2
  * @throws   HTTP_Request2_LogicException
  */
 public function setUrl($url)
 {
     if (is_string($url)) {
         $url = new Net_URL2($url, array(Net_URL2::OPTION_USE_BRACKETS => $this->config['use_brackets']));
     }
     if (!$url instanceof Net_URL2) {
         throw new HTTP_Request2_LogicException('Parameter is not a valid HTTP URL', HTTP_Request2_Exception::INVALID_ARGUMENT);
     }
     // URL contains username / password?
     if ($url->getUserinfo()) {
         $username = $url->getUser();
         $password = $url->getPassword();
         $this->setAuth(rawurldecode($username), $password ? rawurldecode($password) : '');
         $url->setUserinfo('');
     }
     if ('' == $url->getPath()) {
         $url->setPath('/');
     }
     $this->url = $url;
     return $this;
 }
开发者ID:OPIN-CA,项目名称:w3c_validator,代码行数:33,代码来源:Request2.php

示例3: setUrl

 /**
  * Sets the URL for this request
  *
  * If the URL has userinfo part (username & password) these will be removed
  * and converted to auth data. If the URL does not have a path component,
  * that will be set to '/'.
  *
  * @param    string|Net_URL2 Request URL
  * @return   HTTP_Request2
  * @throws   HTTP_Request2_Exception
  */
 public function setUrl($url)
 {
     if (is_string($url)) {
         $url = new Net_URL2($url);
     }
     if (!$url instanceof Net_URL2) {
         throw new HTTP_Request2_Exception('Parameter is not a valid HTTP URL');
     }
     // URL contains username / password?
     if ($url->getUserinfo()) {
         $username = $url->getUser();
         $password = $url->getPassword();
         $this->setAuth(rawurldecode($username), $password ? rawurldecode($password) : '');
         $url->setUserinfo('');
     }
     if ('' == $url->getPath()) {
         $url->setPath('/');
     }
     $this->url = $url;
     return $this;
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:32,代码来源:Request2.php


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