Firebug show import语句加载两次

时间:2011-07-04 14:34:02

标签: php firefox firebug

我的index.php文件中有很少的import语句。网站有点慢,所以我试图调试它。当我第一次加载页面时,firebug显示它正在加载两次import语句。第二个'副本'可以说仍在加载(它有动态指示器,它正在加载)。我在firebug中使用Net来查看结果。

在Chrome中,它只显示一次。我有最新的稳定版本1.7.3,我使用的是firefox 5.

Index.php有两个include_once语句。首先包括文件具有数据库连接和少量import语句。第二个有标题(简单的HTML语句 - 没什么特别的。)

这是一个萤火虫问题还是我的问题?

的index.php

<htmL>
<head>
</head>
<body>
<?php

include_once('db_con.php');
include_once('header.php');

?>

<div id="displayAjax"></div>

</body>
</html>

db_con.php

<?php
$host="host";
$username="user";
$password="pass";
$database="dbname";

$table1="table1";
$table2="table2";
$table2="table3"; 

$con = mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
$select_db = mysql_select_db("$database")or die("cannot select DB");

ini_set('max_execution_time', 300);

session_start(); 
?>

<html>
<head>
<link rel="stylesheet" type="text/css" href="import/file.css" />
<script type="text/javascript" src="import/jquery.js"></script>
<script type="text/javascript" src="import/ajax.js"></script>

</head>
</html>

的header.php

<?php
include_once('db_con.php');
?>

<html>
<head>
</head>
<body>
<div>
<p>Title</p>


Search for: 
<input type="textbox" size="27" id="id" class="class" />
<input type="button" value="Search" onclick="searchFunction()" />
</div>    
</body>
</html>

所以我创建了一个新文件new.html。只有HTML语法,没有PHP或JS。

<html>
<head>
<title>Title</title>
</head>

<body>

<p>Something</p>

</body>
</html>

我直接去了链接没有包含或导入。这个仍然加载两次。第一个加载并显示“Something”第二个仍然加载动态指标。

1 个答案:

答案 0 :(得分:2)

解决了所有包含后,您将拥有两个完整的HTML文档。浏览器决定对生成的无效文档做什么取决于浏览器。

db_con.php中取出HTML;它与数据库连接无关。

相关问题