IIS - 运行 PHP 无法识别文件路径
我刚刚为 IIS7 安装了 PHP。我已经为我的项目设置了一个虚拟目录,以便我可以浏览到 http://localhost/myproj/index.php
当我浏览到 index.php 时,我收到 javascript 的 404 错误我想要包含的文件。
在index.php中,我像这样包含它们:
<script language="javascript" type="text/javascript" src="/_inc/jquery.js"></script>
它没有在我的虚拟目录下查找javascript文件,而是尝试在根目录下搜索它。 http://localhost/_inc/jquery.js
有没有办法让它在我的虚拟目录下查找包含内容?
I just installed PHP for IIS7. I've set up a virtual directory to my project so that I can browse to http://localhost/myproj/index.php
When I browse to index.php, I get 404 errors for the javascript files that I want to include.
In index.php I'm including them like so:
<script language="javascript" type="text/javascript" src="/_inc/jquery.js"></script>
instead of looking for javascript file under my virtual directory, it tried to search it under root. http://localhost/_inc/jquery.js
Is there a way to make it look for includes under my virtual directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为你告诉它这样做。当您定义带有前导斜杠
/
的路径时,它始终被视为绝对路径。浏览器不关心“虚拟目录”之类的东西。Because you're telling it to do so. When you define a path with leading slash
/
, then it is always treated as absolute. The browser doesn't care about something like "virtual directories".