Mhari Posted May 26, 2016 Share Posted May 26, 2016 Hello, how to include file without problem in path of files? And not causing error? Example, if i am installing wordpress, i can install it in everywhere like home/a/b/c.. Please help me.. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 26, 2016 Share Posted May 26, 2016 You can either use a relative path instead of an absolute path, or have a global include file which defines things like the absolute path to the root of your application that you can use to include other files from that point. Link to comment Share on other sites More sharing options...
Mhari Posted May 26, 2016 Author Share Posted May 26, 2016 What do you mean about global include file? I am sorry i dont know thanks, Link to comment Share on other sites More sharing options...
justsomeguy Posted May 26, 2016 Share Posted May 26, 2016 Most applications, like Wordpress, have a single include file that all other files include. It contains global application settings or options, like database connection information, the main URL of the site, things like that. It can also contain the path where your application is installed, so you can use that to include any other file. You can get the full path to the current directory using the __DIR__ constant, it will be set to the directory where the PHP file is. <?php echo 'This script is at ' . __FILE__ . '<br>'; echo 'The directory is ' . __DIR__ . '<br>'; echo 'The parent directory is ' . dirname(__DIR__) . '<br>'; http://php.net/manual/en/language.constants.predefined.php Link to comment Share on other sites More sharing options...
Mhari Posted May 27, 2016 Author Share Posted May 27, 2016 Ok i will create it. Thanks :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now