php - Which one is the best way to get the URL in CodeIginter using base_url() URL helper? -


as per user guide, can url in codeigniter in following way using url helper:

echo base_url('admin/profile'); 

but saw 1 developer using code this:

echo base_url() . 'admin/profile'; 

which 1 think faster?

i think both not make difference, under hood, must concatenating string passed in parameter. follow coding standard, former method better. right or wrong?

code igniter base_url() call too

function base_url($uri = '')     {         return $this->slash_item('base_url').ltrim($this->_uri_string($uri), '/');     } 

so base_url().$string not same base_url($string).

also may interested in override base_url method in future , have other specifics process on uri.

so standard approach is:

echo base_url('admin/profile'); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -