Favicon没有展示

时间:2013-11-13 09:42:52

标签: php favicon ico

我有一个小问题。

在我的某些页面上,我无法显示图标。

在某些网页上,一切都很好,并且正确显示了图标,但在其他网站上我无法显示图标。我尝试将ico文件放在主目录中,但没有任何结果。

这个file1.php工作正常:

<? include("core/config.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="include/style.css" rel="stylesheet" type="text/css">
<title>Title</title>
<link rel="shortcut icon" type="image/x-icon" href="img/flavico.fw.ico">
<script type="text/javascript" src="include/script.js"></script>
</head>

然而,在这一个图标上没有显示:

<?php include("core/config.php");
include("include/resolution.php"); 
function new_function($nazwa){
global $wys;
global $db;
$wys->some_function($ub,$na,$ub_pod);   
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
<link rel="shortcut icon" type="image/x-icon" href="img/flavico.fw.ico">
<link href="include/style.css" rel="stylesheet" type="text/css">
</head>

我认为这个问题是由php函数引起的,对吗?

1 个答案:

答案 0 :(得分:2)

请显示两个页面的网址。 在相对网址中猜出你的问题。假设第一个网址为http://mysite.org/file1.php,第二个网址为http://mysite.org/subsecrion/file2.php 那么你应该使用favicon的绝对路径:

<link rel="shortcut icon" type="image/x-icon" href="/img/flavico.fw.ico">

或添加标签:

<base href="http://mysite.org/">