wok/uri

v1.2.5 2017-03-07 09:36 UTC

This package is auto-updated.

Last update: 2024-09-25 06:38:21 UTC


README

这个库是一个 URI 管理接口。

SensioLabsInsight

免责声明:此组件是 WOK (Web Operational Kit) 框架的一部分。然而,它可以作为一个独立的库使用。

安装

建议使用 Composer 将该组件作为依赖项安装。

composer require wok/uri

如果您愿意,也可以通过 git 或通过 直接下载 来获取它,因为此包没有依赖项。

git clone https://github.com/web-operational-kit/uri.git

用法

use \WOK\Uri\Uri

// First instanciate a URI object
$uri = Uri::createFromString('http://domain.tld/path/to/resource?param=abc');

// Then you can either retrieve informations ...
$uri->getScheme();


// ... or update them

查看完整的 方法和组件列表 作为 API。

方法和组件

提示:

  • getX 前缀的方法返回值或相关对象
  • setX 前缀的方法覆盖当前值或相关对象
  • withX 前缀的方法使用新值克隆当前的 Uri 对象。

字符串值

  • getScheme()

  • setScheme($scheme)

  • withScheme(scheme)

  • getFragment()

  • setFragment($fragment)

  • withFragment(fragment)

主机组件

  • getHost()
  • setHost($host)
  • withHost($host)

路径组件

  • getPath()
  • setPath($path)
  • withPath($path)

查询组件

  • getQuery()
  • setQuery($query)
  • withQuery($query)

用户组件

  • getUser()
  • setUser($user)
  • withUser($user)