【发布时间】:2013-12-14 23:31:52
【问题描述】:
好吧,我可能没有最好的标题,但我会尽力给出更好的解释。
假设您正在使用 PHP include() 来构建您的网站:
Header.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name=keywords content="somthiefn"/>
<title>Website</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<script src="Scripts/jquery-1.8.3.min.js"></script>
<link rel="icon" type="image/png" href="/images/favicon.ico" />
</head>
<body>
Footer.php
</body>
</html>
然后是一个示例页面:
Index.php
<!--Header-->
<?php include ('includes/header.php'); ?>
<div class="content">
<!-- some content-->
</div>
<!--Footer-->
<?php include ('includes/footer.php'); ?>
基本上我只是想知道是否有办法将一些脚本加载到我的标题部分。
我想实现像 ASP.NET 及其母版页这样的东西,我可以在其中添加内容的标题。例如
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script src="Scripts/somescript.js"></script>
</asp:Content>
【问题讨论】:
-
脚本最好放在页脚
</body>之前 -
@popnoodles 是的,我知道,这只是一个例子,因为我需要对
css文件做同样的事情