PHP代码需要另一个脚本从低四个目录级别


PHP code to require another script from four directory levels lower

我是php的新手,我有一个问题,在我的代码中运行另一个脚本。我想要运行的脚本都在相同的文件夹,但其中一个被包含在文件夹四个级别以下。请帮帮我。我的目录树如下所示。

websystem'-
          |-Administrator'
          |-vehicle_details'vehicles'aston_martin'index.php
          |-explore-vehicle.php
require(".../websystems/explore-vehicle.php");

我已经写了我的代码上面,但它似乎不运行脚本。假设我的主目录是aston_martin,我想运行以下四层的脚本explore-vehicle.php。我的目录是'websystems'vehicles_details'vehicles'aston_martin'index.php,我想在'websystems'explore-vehicle.php中运行一个脚本。

您可能需要以下内容(假设您在aston_martinindex.php页面上):

require("../../../explore-vehicle.php");

如果你需要改变一个不同的目录,而不仅仅是你最终的目录,你可以这样做,例如:

require("../../../../websystem/explore-vehicle.php");