改名
This commit is contained in:
@@ -205,11 +205,15 @@ class Uri implements UriInterface
|
|||||||
*/
|
*/
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
if (empty($this->query) && empty($this->fragment)) {
|
$domain = sprintf('%s://%s', $this->scheme, $this->host);
|
||||||
return sprintf('%s://%s:%d%s', $this->scheme, $this->host, $this->port, $this->path);
|
if (!in_array($this->port, [80, 443])) {
|
||||||
|
$domain .= ':' . $this->port;
|
||||||
}
|
}
|
||||||
return sprintf('%s://%s:%d%s?%s#%s', $this->scheme, $this->host, $this->port,
|
if (empty($this->query) && empty($this->fragment)) {
|
||||||
$this->path, $this->query, $this->fragment);
|
return $domain . '/' . $this->path;
|
||||||
|
}
|
||||||
|
return sprintf('%s?%s#%s', $domain . '/' . $this->path,
|
||||||
|
$this->query, $this->fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user