【发布时间】:2010-07-29 02:18:58
【问题描述】:
我正在使用 php 开发我的第一个网站。我想出了一个好方法,或者我想,根据我的位置来处理包含 css 表的问题。例如,我有一个使用以下代码提交的表单:
$root = '../';
function died($error)
{
include '../includes/header.php';
echo "We are very sorry, but there were error(s) found with the form your submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
include '../includes/footer.php';
die();
}
我将变量 $root 设置为“../”,然后这里是 header.php 的相关部分:
<link href="<?php echo $root;?>styles/styles.css" rel="stylesheet" type="text/css" />
我认为它会在样式前添加“../”,但它没有添加任何内容。为什么这不起作用?
谢谢!
【问题讨论】:
-
不要表现得像预期的那样,但我同意@webdestroya:只需一秒钟即可将答案标记为已接受。回顾您的一些旧问题并将最佳答案标记为已接受(复选框标记答案)。我会是你最好的朋友!我给你口香糖!
-
对不起,我是这个网站的新手!我的很多问题都没有得到解答,但这个问题似乎有很多答案,所以我会一一解答!