php - codeigniter: why is that when i echo base_url() in an href attribute of an anchor tag, it echoes twice -
So basically when I resonate the codeigniter function base_url () in the href attribute of anchor tag, it resonates Twice Example:
& lt; A href = "& lt ;? php echo base_ url () ;? & gt;" & Gt; A type of cone & lt; / A & gt; And above, if you inspect it, then your Chrome browser shows it:
& lt; A href = "www.mysitedomainname.com/www.mysitedomainname .com /" & gt; Somelink & lt; / A & gt; "mysitedomainname.com" is just a name created for this example. Why is this happening for any reason?
There are three reasons for which I know that the cause may be
First one happens when config.php is written on line 17 $ config ['base_url'] = ''; - It's okay to be better left blank, just like you download the CI. Second, it is that if you have set $ config ['base_url'] without code or Other protocols The third is someone, if you have set the base href from somewhere: & lt; Base href = "http://www.mysitedomainname.com/" /> When you want to link to another page, you should site_url () , base_url () stylesheets, JS, IMG SRT properties and other real URLs can be used for links. The reason for this is very simple, in the base_url () the index_page value is not set to config.php .
Comments
Post a Comment