【发布时间】:2012-02-29 15:07:18
【问题描述】:
您好,我正在尝试使用 php 创建一个网站,其结构如下所示:
-index.php
-header.php
-footer.php
-style.css
-images\{images are in this folder}
-\web\index.php
-\contact\index.php
问题是我在所有 index.php 文件上使用 php 的包含函数来使用 header.php 和 footer.php 文件,但问题是只有根文件夹中的 index.php 显示样式,但是当我打开 localhost/web/index.php 时,由于找不到 css 和图像,页面看起来很糟糕。
我该如何解决这个问题。
请帮忙
【问题讨论】:
-
确保使用绝对 URL 来包含 css、图像和 js。
-
你能告诉我如何使用绝对路径
-
使用静态文件的完整路径例如:而不是
images/abc.gif使用/images/abc.gif