如何为一个网站使用多个图标 [英] How to use multiple favicons for one site

查看:110
本文介绍了如何为一个网站使用多个图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了相当多的搜索和阅读,试图找到一个解决方案,但没有出现或与任何对我有用的东西还没有。我正在建造一个带有彩色主题结构的网站。我想让每个页面使用不同的彩色favicon它的相应的页面颜色。例如:

I've done quite a bit of searching and reading on trying to find a solution but have not come up or across with anything that has worked for me just yet. I am building a site that carries a colored themed structure. I would like to have each page use a different colored favicon for it's corresponding page color. For example:


  • 第1页/ background color = blue - > blue favicon。

  • 第2页/ background color = red - > red favicon。

  • Etc。

我遇到的最接近的是使用PHP方法并在图标文件末尾添加一个数字 -

The closest I came across was a using a PHP method and appending a number to the end of the icon file -

<?php echo '<link rel="shortcut icon" href="http://www.yoursite.com/favicon.ico?t=' . time() . '" />; ?>

除非php是错误的,这似乎并不适用于我。
我不是PHP中最强的,但如果有任何建议或相关阅读,这将是很好的。

Unless the php is wrong, this didn't seem to work for me. Im not the strongest in PHP but if anyone has any suggestions or relevant reading on this it would be appreciated.

推荐答案

>

<?php
       if ( condition to display first favicon )
           echo '<link rel="shortcut icon" href="http://www.yoursite.com/favicon1.ico" />';
       else
           echo '<link rel="shortcut icon" href="http://www.yoursite.com/favicon2.ico" />';
?>

这篇关于如何为一个网站使用多个图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆