使用PHP获取当前用户桌面路径-WampServer [英] Get Current User Desktop Path using PHP - WampServer

查看:438
本文介绍了使用PHP获取当前用户桌面路径-WampServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用代码:

echo getenv("HOMEDRIVE").getenv("HOMEPATH"); 

我正在访问台式机(C:\Users\my_user\Desktop)在Xampp中。但是,相同的代码在WampServer中无法正常工作。它返回空值。我不知道该如何解决此问题。

I'm getting the path to Desktop (C:\Users\my_user\Desktop) in Xampp. But the same code is not working poperly in WampServer. It's returning null value. I don't know how to correct this issue.

请帮助我。

在此先感谢。

推荐答案

函数getenv()为您提供由Web服务器设置的环境变量的值,或者您的本地计算机充当Web服务器甚至远程服务器。

The function getenv() you gives you the value of environment variables set with your web server either your local computer acting as web server or even remote server.

不同的开发服务器以不同的方式存储环境变量的值,这是因为WAMP的行为不同而XAMPP在您的计算机上也有所不同。

Different development servers store the values of environment variables differently, due to this WAMP is acting differently and XAMPP is differently on your computer.

尝试调用phpinfo()函数,您将看到当前安装中所有可用环境变量的完整列表。有关更多详细信息,请参见下面的链接

Try to make call to phpinfo() function, and you will see the complete list of all environment variables available in current installation. For more detailed information see the link below

http:// in3.php.net/getenv

http://in3.php.net/manual/en/function.phpinfo.php

快乐编码!

谢谢

Atul Jindal

Atul Jindal

这篇关于使用PHP获取当前用户桌面路径-WampServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆