Google News
logo
CodeIgniter - Interview Questions
What is the work of anchor tag in CodeIgniter?
Anchor tag creates a standard HTML anchor link based on the URL of your local site.
Syntax :
anchor($uri = '', $title = '', $attributes = '')
Here, $uri represents a URI string, $title represents an anchor title and $attributes represents an HTML attributes. It returns an HTML hyperlink (anchor tag) of string type.

The first parameter can have any segments you would like to append to the URL. These segments can be a string or an array.
 
The second parameter is the text that will be displayed with a link. The URL will be used in case you leave it blank.
 
The third parameter can contain an attribute list you would like added to the link. The attributes can be a string or an associative array.
 
Example :
echo anchor('details/local/123', 'My Details', 'title="Details title"');
// Prints: <a href="http://example.com/index.php/details/local/123" title="Details title">My Details</a>
Advertisement