PHP相对路径

PHP相对路径,php,Php,我已经构建了一个简单的初级PHP网站,并按照指示: use relative paths for any links in your assignment – I should not need to deploy your assignment into the same folder structure that you developed it in when marking 但我不太明白这意味着什么,据我所知,我所做的一切都是将我所有的文件放在: XAMPP\htdocs\Websit

我已经构建了一个简单的初级PHP网站,并按照指示:

use relative paths for any links in your assignment – I should not need to deploy
your assignment into the same folder structure that you developed it in when marking
但我不太明白这意味着什么,据我所知,我所做的一切都是将我所有的文件放在:

XAMPP\htdocs\WebsiteFolder
WebsiteFolder是作业的根目录,我的文件中的链接仅显示如下示例:

header('Location: somephpfile.php')
<a href="somephpfile.php">Click Me</a> 
header('位置:somephpfile.php')

我在这方面的要求对吗?

你似乎在正确的轨道上。相对链接是与根目录相关的链接

在您的例子中,
XAMPP\htdocs\WebsiteFolder
似乎是根目录,假设您有
images
style
目录,其中有
index.php
文件,
index.php
中的相对路径如下所示:

/images/house.png

而从
styles
目录中的CSS文件到同一文件的相对路径如下所示:

。/images/house.png

其中,
表示当前目录,
表示父目录


这样,当整个项目目录移动到硬盘驱动器上的其他位置或其他计算机上时,链接不需要编辑。

是的,这些是相对路径。