How to set Favicon in Codeigniter

后端 未结 3 1788
孤城傲影
孤城傲影 2021-01-01 15:11

I know this is a stupid question, but I can\'t find the answer anywhere. If I\'m using Codeigniter, where do I save my favicon file so that it will pop up in the browser?

相关标签:
3条回答
  • 2021-01-01 15:50

    I have used this in my code and its working fine

    <pre>
    <link rel="icon" href="<?php echo base_url(); ?>favicon.ico" type="image/gif">
    </pre>
    
    0 讨论(0)
  • 2021-01-01 16:01

    It depends on your organization. I usually put the favicon.gif file in the web root folder, so the URL would be yourdomain.com/favicon.gif

    Then you have to add the following line of code into your HTML <head>:

    <link rel="icon" href="<?=base_url()?>/favicon.gif" type="image/gif">
    

    Assuming that the URL Helper is loaded in CodeIgniter. You can load it via $this->load->helper('url'); or add it into the autoload helper array in your config folder.

    0 讨论(0)
  • 2021-01-01 16:04

    You could load the HTML helper and use <?php echo link_tag('favicon.ico', 'shortcut icon', 'image/ico'); ?> on the <head> html tag. More information in http://codeigniter.com/user_guide/helpers/html_helper.html#link_tag

    0 讨论(0)
提交回复
热议问题