CUrlRule
| Package | system.web |
|---|---|
| Inheritance | class CUrlRule » CComponent |
| Since | 1.0 |
| Version | $Id: CUrlManager.php 714 2009-02-20 02:03:04Z qiang.xue $ |
CUrlRule represents a URL formatting/parsing rule.
It mainly consists of two parts: route and pattern. The former classifies the rule so that it only applies to specific controller-action route. The latter performs the actual formatting and parsing role. The pattern may have a set of named parameters each of specific format.
It mainly consists of two parts: route and pattern. The former classifies the rule so that it only applies to specific controller-action route. The latter performs the actual formatting and parsing role. The pattern may have a set of named parameters each of specific format.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| append | boolean | whether the URL allows additional parameters at the end of the path info. | CUrlRule |
| caseSensitive | boolean | whether the rule is case sensitive. | CUrlRule |
| params | array | list of parameters (name=>regular expression) | CUrlRule |
| pattern | string | regular expression used to parse a URL | CUrlRule |
| route | string | the controller/action pair | CUrlRule |
| signature | string | a token identifies the rule to a certain degree | CUrlRule |
| template | string | template used to construct a URL | CUrlRule |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __call() | Calls the named method which is not a class method. | CComponent |
| __construct() | Constructor. | CUrlRule |
| __get() | Returns a property value, an event handler list or a behavior based on its name. | CComponent |
| __isset() | Checks if a property value is null. | CComponent |
| __set() | Sets value of a component property. | CComponent |
| __unset() | Sets a component property to be null. | CComponent |
| asa() | Returns the named behavior object. | CComponent |
| attachBehavior() | Attaches a behavior to this component. | CComponent |
| attachBehaviors() | Attaches a list of behaviors to the component. | CComponent |
| attachEventHandler() | Attaches an event handler to an event. | CComponent |
| canGetProperty() | Determines whether a property can be read. | CComponent |
| canSetProperty() | Determines whether a property can be set. | CComponent |
| createUrl() | CUrlRule | |
| detachBehavior() | Detaches a behavior from the component. | CComponent |
| detachBehaviors() | Detaches all behaviors from the component. | CComponent |
| detachEventHandler() | Detaches an existing event handler. | CComponent |
| disableBehavior() | Disables an attached behavior. | CComponent |
| disableBehaviors() | Disables all behaviors attached to this component. | CComponent |
| enableBehavior() | Enables an attached behavior. | CComponent |
| enableBehaviors() | Enables all behaviors attached to this component. | CComponent |
| getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
| hasEvent() | Determines whether an event is defined. | CComponent |
| hasEventHandler() | Checks whether the named event has attached handlers. | CComponent |
| hasProperty() | Determines whether a property is defined. | CComponent |
| parseUrl() | CUrlRule | |
| raiseEvent() | Raises an event. | CComponent |
Property Details
append
property
public boolean $append;
whether the URL allows additional parameters at the end of the path info.
caseSensitive
property
(available since v1.0.1)
public boolean $caseSensitive;
whether the rule is case sensitive. Defaults to true.
params
property
public array $params;
list of parameters (name=>regular expression)
pattern
property
public string $pattern;
regular expression used to parse a URL
route
property
public string $route;
the controller/action pair
signature
property
public string $signature;
a token identifies the rule to a certain degree
template
property
public string $template;
template used to construct a URL
Method Details
__construct()
method
|
public void __construct(string $route, string $pattern)
| ||
| $route | string | the route of the URL (controller/action) |
| $pattern | string | the pattern for matching the URL |
Constructor.
createUrl()
method
|
public string createUrl(array $params, string $suffix, string $ampersand)
| ||
| $params | array | list of parameters |
| $suffix | string | URL suffix |
| $ampersand | string | the token separating name-value pairs in the URL. |
| {return} | string | the constructed URL |
parseUrl()
method
|
public string parseUrl(string $pathInfo)
| ||
| $pathInfo | string | path info part of the URL |
| {return} | string | the route that consists of the controller ID and action ID |