Class \Prado\Web\TUrlManager
TUrlManager is the base class for managing URLs that can be recognized by PRADO applications. It provides the default implementation for parsing and constructing URLs.
Derived classes may override constructUrl and parseUrl to provide customized URL schemes.
By default, THttpRequest uses TUrlManager as its URL manager. If you want to use your customized URL manager, load your manager class as an application module and set \Prado\Web\THttpRequest::setUrlManager with the ID of your URL manager module.
Class hierarchy
- \Prado\Web\TUrlManager
- \Prado\TModule implements IModule
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0.6
public
|
constructUrl(string $serviceID, string $serviceParam, array<string|int, mixed> $getItems, bool $encodeAmpersand, bool $encodeGetItems) : string
Constructs a URL that can be recognized by PRADO.
This method provides the actual implementation used by THttpRequest::constructUrl. Override this method if you want to provide your own way of URL formatting. If you do so, you may also need to override parseUrl so that the URL can be properly parsed. The URL is constructed as the following format:
If \Prado\Web\THttpRequest::setUrlFormat is 'Path', the following format is used instead:
If \Prado\Web\THttpRequest::setUrlFormat is 'HiddenPath', then entryscript.php will be hidden and the following format is used instead:
In order to use the 'HiddenPath' format you need proper url rewrite configuration; here's an example for Apache's .htaccess:
|
public
|
parseUrl() : array<string|int, mixed>
Parses the request URL and returns an array of input parameters.
This method is automatically invoked by THttpRequest when handling a user request. In general, this method should parse the path info part of the requesting URL and generate an array of name-value pairs according to some scheme. The current implementation deals with both 'Get' and 'Path' URL formats. You may override this method to support customized URL format. |
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |