linux - Best way for PHP5 CLI to formulate Base Directory? -
OK, I have a code base that is in a folder / my program / and it has many folders like / myProgram / Lib /, / my program / docs / and so on ...
How, in PHP, before I / my program can go to any folders to locate and create a base variable So that I need to be involved in my writing and the written relative
does not need to work in the window, I Zhe is the original directory / my program / root, Suite Directors, / path / to / allowed to keep their programs in some of my programs / etc? Only one * nicke environment is from all command line parser or executable scripts.
I suggest using the relative path from the current file:
Include (Dynamics (__file__). '/ .. / include / something.inc.php');
It may be difficult to change a directory name that can be changed as a profit, it should work on any system.
You can do anything like this:
// For MyProgram / include / config.php example:
And then you can use the following:
code> included (BASE_DIR / ./class.php);
I firmly recommend any solutions that include the name of hardcoding which is in your app.
Comments
Post a Comment