【发布时间】:2011-01-14 21:04:36
【问题描述】:
如果我在 PHP 页面(例如 index.php)中包含 HTML 页面,其中包含以下内容:
<?php
include ("../../forms/login/form.html");
?>
那么form.php会在index.php中正确显示吗?当我说得正确时,我的意思是它的所有图像和 CSS。
我问的原因是因为我不是这种情况。我试了一下,它会显示 form.html 但没有任何样式...
任何帮助将不胜感激,谢谢!
更新:
目前,我在 forms.html 上有以下内容:
<link href="view.css" media="all" rel="stylesheet" type="text/css" />
<script src="view.js" type="text/javascript"></script>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
现在,forms.html 本身可以正确显示。
在 index.php 上,我有:
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>UofS :: Residence Life Management System</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include ("html/header.html");
?>
<?php
include ("php/navigation.php");
?>
<br></br>
<?php
include ("forms/login/form.html");
?>
<br></br>
<?php
include ("html/footer.html");
?>
</body>
</html>
对forms.html 的唯一引用是通过php include()。没有指向它的样式表。这是没有正确加载 forms.html 的页面。这不对吗?
谢谢!
【问题讨论】:
-
这是我最喜欢的关于 include 的思考方式……它本质上是复制和粘贴……但更简洁!