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


PHP URL::getPort方法代码示例

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


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

示例1: toExternalForm

 /**
  * @param URL $u
  * @return blaze\lang\String
  */
 public function toExternalForm(URL $u)
 {
     $str = $u->getScheme() . '://';
     if ($u->getUser() != null) {
         $str .= $u->getUser();
         if ($u->getPassword() != null) {
             $str .= ':' . $u->getPassword();
         }
         $str .= '@';
     }
     $str .= $u->getHost();
     if ($u->getPort() != -1) {
         $str .= ':' . $u->getPort();
     }
     if ($u->getPath() != null) {
         $str .= '/' . $u->getPath();
     }
     if ($u->getQuery() != null) {
         $str .= '?' . $u->getQuery();
     }
     if ($u->getFragment() != null) {
         $str .= '#' . $u->getFragment();
     }
     return new \blaze\lang\String($str);
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:29,代码来源:URLStreamHandler.php

示例2: __construct

 /**
  * Constructor
  *
  * @param   util.cmd.ParamString args
  */
 public function __construct(ParamString $args)
 {
     $url = new URL($args->value(0));
     // If protocol string does not contain port number, set default.
     if (self::ESDL_PORT === $url->getPort(self::ESDL_PORT)) {
         $url->setPort(self::ESDL_PORT);
     }
     // Check given URL to inform user if invalid port used.
     if (self::ESDL_PORT !== $url->getPort()) {
         Console::$err->writeLine('Notice: using non-standard port ' . $url->getPort() . ', ESDL services are usually available at port 6449.');
     }
     $this->remote = Remote::forName($url->getURL());
     $this->jndi = $args->value(1);
     $this->processor = new DomXSLProcessor();
     $this->processor->setXSLBuf($this->getClass()->getPackage()->getResource($args->value('lang', 'l', 'xp5') . '.xsl'));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:21,代码来源:Generator.class.php

示例3: setup

 /**
  * Setup the class instance. A dsn string must be given with the relevant information
  * about the server and script:
  *
  * Eg: nagios://nagios.xp_framework.net:5667/service_to_monitor
  *
  * @param   string dsn
  */
 public function setup($dsn)
 {
     $url = new URL($dsn);
     $this->server = $url->getHost();
     $this->port = $url->getPort(5667);
     $this->version = $url->getParam('version', NSCA_VERSION_2);
     $this->service = trim($url->getPath(), '/');
     $this->host = $url->getParam('hostname', System::getProperty('host.name'));
     if (FALSE !== $url->getParam('domain', FALSE)) {
         $this->host .= '.' . ltrim($url->getParam('domain'), '.');
     }
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:20,代码来源:Heartbeat.class.php

示例4: newSocket

 /**
  * Creates a socket
  *
  * @param   peer.URL url
  * @param   string arg
  * @return  peer.Socket
  */
 protected function newSocket(URL $url, $arg)
 {
     return new Socket($url->getHost(), $url->getPort(80));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:11,代码来源:SocketHttpTransport.class.php

示例5: testGetPort

 /**
  * @covers \URLParser\URL::__construct
  * @covers \URLParser\URL::getPort
  */
 public function testGetPort()
 {
     $url = new URL($this->testUrl);
     $this->assertEquals($this->port, $url->getPort());
 }
开发者ID:smokeelow,项目名称:php-url-parser,代码行数:9,代码来源:URLTest.php

示例6: newSocket

 /**
  * Creates a socket - overridden from parent class
  *
  * @param   peer.URL url
  * @param   string arg
  * @return  peer.Socket
  */
 protected function newSocket(URL $url, $arg)
 {
     sscanf($arg, 'v%d', $version);
     return new SSLSocket($url->getHost(), $url->getPort(443), NULL, $version);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:12,代码来源:SSLSocketHttpTransport.class.php

示例7: ipv6AddressAndPort

 public function ipv6AddressAndPort()
 {
     $u = new URL('http://[::1]:8080');
     $this->assertEquals('[::1]', $u->getHost());
     $this->assertEquals(8080, $u->getPort());
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:6,代码来源:URLTest.class.php

示例8: navigateTo

 /**
  * Navigate to a given URL
  *
  * @param   string target
  * @param   string params
  * @param   string method
  * @throws  unittest.AssertionFailedError  
  */
 public function navigateTo($target, $params = NULL, $method = HttpConstants::GET)
 {
     if (strstr($target, '://')) {
         $url = new URL($target);
         $this->conn = $this->getConnection(sprintf('%s://%s%s/', $url->getScheme(), $url->getHost(), -1 === $url->getPort(-1) ? '' : ':' . $url->getPort()));
         $params ? $url->setParams($params) : '';
         $this->beginAt($url->getPath(), $url->getParams(), $method);
     } else {
         if ('' !== $target && '/' === $target[0]) {
             $this->beginAt($target, $params, $method);
         } else {
             $base = $this->getBase();
             $this->beginAt(substr($base, 0, strrpos($base, '/')) . '/' . $target, $params, $method);
         }
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:24,代码来源:WebTestCase.class.php

示例9: _parsedsn

 /**
  * Parse DSN
  *
  * @param   string dsn
  * @return  bool success
  */
 protected function _parsedsn($dsn)
 {
     if (NULL === $dsn) {
         return TRUE;
     }
     $u = new URL($dsn);
     if (!$u->getHost()) {
         throw new IllegalArgumentException('DSN parsing failed ["' . $dsn . '"]');
     }
     // Scheme
     switch (strtoupper($u->getScheme())) {
         case 'ESMTP':
             $this->ext = TRUE;
             break;
         case 'SMTP':
             $this->ext = FALSE;
             break;
         default:
             throw new IllegalArgumentException('Scheme "' . $u->getScheme() . '" not supported');
     }
     // Copy host and port
     $this->host = $u->getHost();
     $this->port = $u->getPort() ? $u->getPort() : 25;
     // User & password
     if ($u->getUser()) {
         $this->auth = $u->getParam('auth', SMTP_AUTH_PLAIN);
         $this->user = $u->getUser();
         $this->pass = $u->getPassword();
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:36,代码来源:SmtpTransport.class.php


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