codeigniter - 如何在Codeigniter中设置Favicon

标签 codeigniter favicon

我知道这是一个愚蠢的问题,但我找不到任何答案。如果我使用Codeigniter,我该在哪里保存我的favicon文件,以便它将在浏览器中 pop ?还是我找不到的文件中有配置选项?这真让我抓狂!

非常感谢您的帮助。

最佳答案

这取决于您的组织。我通常将favicon.gif文件放在Web根文件夹中,因此URL为yourdomain.com/favicon.gif
然后,您必须将以下代码行添加到HTML <head>中:

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

假定URL Helper已加载在CodeIgniter中。您可以通过$this->load->helper('url');加载它,或将其添加到config文件夹中的autoload helper数组中。

关于codeigniter - 如何在Codeigniter中设置Favicon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3478720/

相关文章:

php - 使用 php 插入或更新 mysql 日期时间字段

php - 如何对 codeigniter 数据库类中的列求和?

php - 是否有像 Google 提供网站图标这样的网站提供 apple-touch-icon 的服务?

ember.js - 如何在 ember-cli 应用程序中链接到 favicon?

python - 在 app.yaml 配置中处理 favicon

php - 图标未加载

php - Codeigniter 函数 "from_label()"给出错误

php - 从 .post 检索数据

css - Codeigniter CSS、JS 和图像未加载,可能假定为目录

php - SoundCloud 如何让 favicon 在按下播放按钮时动态变化?