cristopher evangelista cristopher evangelista - 7 months ago 47
PHP Question

how to get environment variables desktop path

can someone help me to get DESKTOP PATH?

echo "<input type='hidden' value='C:\Users\".getenv('USERNAME')."\Desktop'>";


it returns C:\Users\IT-TUPER$\Desktop

this is my desktop path C:\Users\Tuper\Desktop

Answer

In php by no means you can't have Desktop Path on a real server, as php is serverside. However if you're on localhost like xampp, wamp, or whatever on windows you try this :

<?php  echo getenv("HOMEDRIVE").getenv("HOMEPATH")."\Desktop";  ?>
Comments