php - What is the difference betweed getcwd and __DIR__? -


dir magic constant stated in php docs. getcwd() current working directory according php docs.

my use case is:

// index.php file require_once __dir__ . '/vendor/autoload.php'; $app = new silex\application(); $app['debug'] = true; $app->get('/{name}', function($name) use($app) {     return $app->sendfile(__dir__ . '/web/source/index.php'); }); 

i don't understand why need either of these mechanisms should able use relative paths.

however code fails out it.

__dir__ executing file is.

getcwd() current directory php file executing from. remember on server , not client , need mindful of directory working from.

this can change.

see here more on concept.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -