You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Derek Jones edited this page Jul 5, 2012
·
4 revisions
I needed to get the domain name only based on the base_url() function.
I added the following function to the url_helper.php :
/** * Get domain * * Return the domain name only based on the "base_url" item from your config file. * * @access public * @return string */functiongetDomain()
{
$CI =& get_instance();
returnpreg_replace("/^[\w]{2,6}:\/\/([\w\d\.\-]+).*$/","$1", $CI->config->slash_item('base_url'));
}
So you can use it in your code in the same manner than site_url() or base_url()