PHP code to require another script from four directory levels lower

I am a newbie in php and I have a problem in getting another script to run in my code. The script I want to run are in the same folders but the one being included are in a folder four levels below.please help me. My directory tree is as shown below.

websystem\-
          |-Administrator\
          |-vehicle_details\vehicles\aston_martin\index.php
          |-explore-vehicle.php

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

I have written my code above but it doesn't seem to run the script. asuming my home directory is aston_martin, I want to run the script explore-vehicle.php four levels below. My directory is \websystems\vehicles_details\vehicles\aston_martin\index.php and I want to run a script in \websystems\explore-vehicle.php.

Answers


You probably want something along the lines of (assuming you're on the index.php page in aston_martin):

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

If you need to change a different directory, other than just the one you end up in, you could do that, e.g:

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

Need Your Help

Access object outside of class

java

This is probably a noob question since I'm just starting Java. I made a Person object with its own class, and a main class that creates the actual object (it's an array too). However, I'm now tryin...

Database table structure for allocation by tier

sql sql-server-2012

I have a four-tiered structure of accounts (from top to bottom):