Windows路径帮助-PHP [英] Help with windows path - PHP
本文介绍了Windows路径帮助-PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此路径,但它是正确的,但是浏览器将不会包含源文件,除非我在其前面加上"file:///".我仍在开发中,最终将在Linux机器上使用,但与此同时,我希望看到自己的工作并能够对其进行故障排除.有解决方案吗?
I have this path and it is correct however, the browser will not include the source file unless I put "file:///" in front of it. I'm still developing and this will ultimately be on a Linux machine but in the mean time, I'd like to see my work as well as be able to troubleshoot it. Is there a solution for this?
此操作失败:
C:\Program Files (x86)\work\site\js\rowlock.js
这不会失败:
file:///C:\Program Files (x86)\work\site\js\rowlock.js
推荐答案
尝试使用变量$ _SERVER ['DOCUMENT_ROOT']使脚本独立.例如:
Try using variable $_SERVER['DOCUMENT_ROOT'] to make your script independent. For example:
include($_SERVER['DOCUMENT_ROOT'].'/js/rowlock.js');
在任何系统上都能正常工作
Works fine on any system
这篇关于Windows路径帮助-PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文