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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -