parse() public static method

Static convenience method for creating a new Url instance.
public static parse ( string $url ) : Url
$url string
return Url
示例#1
0
文件: UrlTest.php 项目: jwage/purl
 public function testBuild()
 {
     $url = Url::parse('http://jwage.com')->set('port', '443')->set('scheme', 'https');
     $url->query->set('param1', 'value1')->set('param2', 'value2');
     $url->path->add('about');
     $url->path->add('me');
     $url->fragment->path->add('fragment1');
     $url->fragment->path->add('fragment2');
     $url->fragment->query->set('param1', 'value1')->set('param2', 'value2');
     $this->assertEquals('https://jwage.com:443/about/me?param1=value1&param2=value2#/fragment1/fragment2?param1=value1&param2=value2', (string) $url);
 }
示例#2
0
文件: Url.php 项目: allmarkedup/sup
 /**
  * Return the path portion of the URL
  * i.e. http://abc.foo.co.uk/this/path => this/path
  *
  * @return string
  */
 public static function path($url)
 {
     return (string) Purl::parse($url)->path;
 }