a() public static method
Generates a hyperlink tag.
See also yii\helpers\Url::to().
public static string a ( $text, $url = null, $options = [] ) | ||
---|---|---|
$text | string |
Link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is coming from end users, you should consider encode() it to prevent XSS attacks. |
$url | array|string|null |
The URL for the hyperlink tag. This parameter will be processed by yii\helpers\Url::to() and will be used for the "href" attribute of the tag. If this parameter is null, the "href" attribute will not be generated. If you want to use an absolute url you can call yii\helpers\Url::to() yourself, before passing the URL to this method, like this: Html::a('link text', Url::to($url, true)) |
$options | array |
The tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered. |
return | string |
The generated hyperlink |
Please login to continue.