auto_link()

auto_link($str, $type = 'both', $popup = FALSE)

Parameters:
  • $str (string) – Input string
  • $type (string) – Link type (‘email’, ‘url’ or ‘both’)
  • $popup (bool) – Whether to create popup links
Returns:

Linkified string

Return type:

string

Automatically turns URLs and e-mail addresses contained in a string into links. Example:

$string = auto_link($string);

The second parameter determines whether URLs and e-mails are converted or just one or the other. Default behavior is both if the parameter is not specified. E-mail links are encoded as safe_mailto() as shown above.

Converts only URLs:

$string = auto_link($string, 'url');

Converts only e-mail addresses:

$string = auto_link($string, 'email');

The third parameter determines whether links are shown in a new window. The value can be TRUE or FALSE (boolean):

$string = auto_link($string, 'both', TRUE);
doc_CodeIgniter
2016-10-15 16:30:52
Comments
Leave a Comment

Please login to continue.