Jump to content

directory help


Worqy

Recommended Posts

Hello.

I use XAMPP,

and lets say I have one file here: XAMPP/htdocs/file1.php

and another one here; XAMPP/htdocs/files/file2.php

 

Now for "file1" to go to "file2" i just use this code "files/file2.php"

but if I want to go from "file2" to "file1". Something like:

"Jump backwards/file1.php"

Need answer ASAP

//K

Link to comment
https://forums.phpfreaks.com/topic/193269-directory-help/
Share on other sites

If you put a slash at the very beginning.. you can make an "absolute" path.. (not exactly absolute)

 

for instance..

if you're link path points to "/htdocs/file1.php"... then that link will work ANYWHERE on that server, because it's explicitly put.

 

on the other hand.. if you don't push a slash in the beginning.  It will look for a folder named htdocs in the current directory the file is in.

 

 

I'm not sure if this method will work on Windows or not though.. haven't tried.

Link to comment
https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017704
Share on other sites

If you put a slash at the very beginning.. you can make an "absolute" path.. (not exactly absolute)

 

for instance..

if you're link path points to "/htdocs/file1.php"... then that link will work ANYWHERE on that server, because it's explicitly put.

 

on the other hand.. if you don't push a slash in the beginning.  It will look for a folder named htdocs in the current directory the file is in.

 

 

I'm not sure if this method will work on Windows or not though.. haven't tried.

 

What if I upload it on a web host. I cant write: C:/Xampp... there.

Whats the code then?

Link to comment
https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017995
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.