Include PHP and directories?

0
$ _ SERVER ['REQUEST_URI'];

$ url="https: //" $ _ SERVER ['SERVER_NAME'

Result = localhost / dashboard / folders / test / florianopolis.php

This code above shows everything, including the file name. Do you have any method of not showing the file?

As soon as you'd like it to stay = localhost / dashboard / folders / test /

FILE shows me this result = link

DIR shows me this result = link

I do not want the full path / Applications / XAMPP / xamppfiles / htdocs /, I just want localhost / dashboard / folders / test /

Because this will serve both the online server and the offline server.

Can anyone help me please?

PS: I edited the previous question, so I think it was clearer!

    
asked by anonymous 19.07.2017 / 20:51

1 answer

2

To maintain a relative path you should always upload to the root directory, and then look for the file to be included.

There are several ways to do this.

$ _ SERVER

$_SERVER['DOCUMENT_ROOT']

Magic constants

__DIR__

Access by include

./

etc ...

Each one with its particularities, such as listing from the current document, and also target variations per operating system

ai is just concatenate with your destination and this path will always be used, idependently from the directory

    
19.07.2017 / 21:20