40 lines
922 B
PHP
40 lines
922 B
PHP
<?php
|
|
|
|
namespace Orbit;
|
|
|
|
class Request
|
|
{
|
|
public $url = '';
|
|
public $scheme;
|
|
public $host;
|
|
public $port;
|
|
public $user;
|
|
public $pass;
|
|
public $path;
|
|
public $query;
|
|
public $fragment;
|
|
|
|
public function __construct($request_input)
|
|
{
|
|
$this->url = $request_input;
|
|
$data = parse_url($request_input);
|
|
|
|
foreach ($data as $key => $value) {
|
|
$this->{$key} = urldecode($value);
|
|
}
|
|
}
|
|
|
|
public function getUrlAppendPath($text)
|
|
{
|
|
return $this->scheme . '://'
|
|
. ($this->user ? $this->user : '')
|
|
. ($this->pass ? ':' . $this->pass : '')
|
|
. ($this->user ? '@' : '')
|
|
. $this->host
|
|
. ($this->port ? ':' . $this->port : '')
|
|
. $this->path . $text
|
|
. ($this->query ? '?' . $this->query : '')
|
|
. ($this->fragment ? '#' . $this->fragment : '');
|
|
}
|
|
}
|