Server.MapPath equivalence in php

Solution:
As mentioned by bobdye,realpath
will resolve and returns the full path.
You can also use__DIR__
, its a magic constant that will return the full path of the current file that is being executed.
For example, if you have a file index.php inc:\inetpub\wwwroot\Staging\Boards\
, you could do the following :
<?php
echo __DIR__ . DIRECTORY_SEPARATOR . 'pdfdownloads' . DIRECTORY_SEPARATOR;
It will output :
c:\inetpub\wwwroot\Staging\Boards\pdfdownloads\
Using the constantDIRECTORY_SEPARATOR
will let the PHP engine take care of using the right directory separator (\
or/
) depending on the OS.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: npm err! code 1
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.