|
Posted by Michael Fesser on 10/15/07 23:25
..oO(duzhidian@gmail.com)
>If I move the programs to other places, using absolute paths will
>suffer, need to change every file.
As long as you keep the folder structure the same, you won't have any
problem. You can always use $_SERVER['DOCUMENT_ROOT'] as your starting
point to build your absolute paths. It becomes even more convenient if
you define some path constants in one of your main PHP files that's
included in every page, and use these constants when you include the
other files. If you change the server, but keep the folder structure,
you would only have to adjust a single file at most, if any.
Absolute paths work always, and you don't have think much about them.
Define them once in a single place - and then just use them.
Micha
Navigation:
[Reply to this message]
|