我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

使用PHP获取本地路径

Can I get a path like this using PHP ?

c:\\wamp\\www\\mysite\\blabla

from the script running in "mysite" or mysite/blabla

basically I want to find the full file path, not just the one from the server, which in this case is located in www :)

Really simple!

print $_SERVER['SCRIPT_FILENAME'];

do a print_r on $_SERVER and check it out :)

__FILE__ magic constant. Works for PHP >= 4.0.2

You should use dirname(__FILE__). You can also use just __DIR__ as of PHP 5.3

近期文章

  • 怎么学习Linux相关命令和操作
  • pycharm mysql 更新错误
  • OJ解决嵌套for循环超市问题
  • unity抗锯齿自动关闭
  • 还是关于if else if else优化问题?
  • 数据类型转换为double并在比较后进行删除
  • git完整流程和工作中开发能使用到的流程
  • RestfulTool插件无法获取参数
  • 在前端中,用什么方法能拿到深层嵌套的数据呢?
  • TypeError:$(selector)为null
  • Ae在行1无法执行脚本
  • 请问我使用了checkbox复选框来选择列表里的记录,但是页面刷新后只给显示最后一个id对应的记录
  • 请问一下这一个为什么不过
  • vue2交互和页面的布局可以在哪里学到?
  • 前端接收不到拦截器return false之前设置的消息
  • pyautogui的locateonscreen图片识别定位错误
  • 在给定的数组中删除数
  • qtwebengine编译
  • 在FreeRTOS系统中,任务如何进行切换?
  • 仅使用$ _POST信息一次

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华