Firebug 显示导入语句被加载两次
我的index.php 文件中几乎没有导入语句。该网站有点慢,所以我尝试调试它。当我第一次加载页面时,萤火虫显示它正在加载导入语句两次。可以说第二个“副本”仍在加载(它具有正在加载的动态指示器)。我正在 firebug 中使用 Net 来查看结果。
然而在 Chrome 中它只显示一次。我有最新的稳定版本 1.7.3,我使用的是 firefox 5。
Index.php 有两个 include_once
语句。第一个包含文件具有数据库连接和少量导入语句。第二个有标题(简单的 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”,第二个仍在加载动态指示器。
I have few import statements in my index.php file. The website is bit slow so I trying to debug it. When I first load the page firebug shows that it's loading the import statements twice. The second 'copy' so to say is still loading(it has the dynamic indicator that it's loading). I am using Net in firebug to see the results.
In chrome however it only shows once. I have the latest stable version 1.7.3 and I am using firefox 5.
Index.php has two include_once
statement. First includes file has the database connections and few import statements. Second one has the header(Simple HTML statements - nothing fancy).
It is a firebug issue or something on my end?
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>
So I created a new file new.html. Only HTML syntax, no PHP or JS.
<html>
<head>
<title>Title</title>
</head>
<body>
<p>Something</p>
</body>
</html>
I went to the link directly no includes or imports. This one still loads twice. First one is loaded and it displays 'Something' second one is still loading with dynamic indicator.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决所有包含问题后,您将拥有两个完整的 HTML 文档。浏览器决定如何处理生成的无效文档取决于浏览器。
从
db_con.php
中取出该HTML;它与数据库连接无关。After all your includes are resolved, you have two full HTML documents. What the browser decides to do with the resulting invalid document is up to the browser.
Take that HTML out of
db_con.php
; it has nothing to do with database connections.