ehough/curly

此包已废弃,不再维护。未建议替代包。

用于处理URL的强大PHP类

1.0.3 2013-04-04 19:52 UTC

This package is not auto-updated.

Last update: 2020-01-24 15:00:00 UTC


README

Build Status Project Status: Unsupported - The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. Latest Stable Version License

此库已不再维护。 用于处理URL的强大类。需要PHP 5.2以上。

  • 尽可能遵循 RFC 3986
  • 完全IPv6兼容
    foo://username:password@example.com:8042/over/there?name=ferret#nose
    \_/   \________________________________/\_________/ \_________/ \__/
     |                     |                     |           |        |
  scheme                authority               path        query   fragment

示例用法

$url = new ehough_curly_Url('foo://username:password@example.com:8042/over/there?name=ferret#nose');

$url->getAuthority();      // username@example.com:8042
$url->getFragment();       // nose
$url->getHost();           // example.com
$url->getPath();           // /over/there
$url->getPort();           // 8042
$url->getQuery();          // name=ferret
$url->getQueryVariables(); // array('name' => 'ferret');
$url->getScheme();         // foo
$url->getUser();           // username

$url->setFragment('ear');
$url->setHost('ehough.com');
$url->setPath('/paved/walkway');
$url->setPort(99);
$url->setQueryVariables(array('moon' => 'rise', 'sun' => 'set'));
$url->setScheme('teleport');
$url->setUser('melissa:salsa');

echo $url->toString(); // teleport://melissa:salsa@ehough.com:99/paved/walkway?moon=rise&sun=set#ear