How do I get absolute path when including a file on Windows.
I tried follow methods:
require_once $_SERVER['DOCUMENT_ROOT']. '../module/account.php';
require_once realpath(dirname(__FILE__)) . '../module/account.php';
require_once __DIR__. '../module/account.php';
and all returned this error:
Warning: require_once(E:\Websites\Xampp\htdocs\protected\views../module/account.php): failed to open stream: No such file or directory in E:\Websites\Xampp\htdocs\minetendo\protected\views\index.php on line 20
Fatal error: require_once(): Failed opening required 'E:\Websites\Xampp\htdocs\protected\views../module/account.php' (include_path='.;E:\Websites\Xampp\php\PEAR') in E:\Websites\Xampp\htdocs\protected\views\index.php on line 20
I see tha path here is incorrect
E:\Websites\Xampp\htdocs\protected\views../module/account.php
But I'm only coding using Windows Operating system. Website will be published on Linux environment.
What can I do to fix this?
Thanks in advance.