本地主机:我希望我的 .php 访问另一个驱动器中的文件夹
本地主机:我希望我的 .php 访问另一个驱动器中的文件夹。
起初我以为可以用 Apache Alias 来完成,但现在我不知道了。
D:/Appserv/www/x/y/file.php
我希望 .php 读取以下内容:
E:/foldie/
localhost: I want my .php to access a folder in another drive.
At first I thought it could be done with Apache Alias, but now I don't know.
D:/Appserv/www/x/y/file.php
I want that .php to read the contents of:
E:/foldie/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,Alias 指令的语法非常简单:
...并且包含的示例阐明了其余部分:
您已将其标记为
PHP
的事实表明您要么尝试在内设置
文件(这是根本不允许的,它需要进入主服务器配置)或将该指令误解为与文件系统符号链接有关(事实并非如此,它只影响 HTTP 请求)。Alias
.htaccess只需在您尝试使用的任何 PHP 函数中输入完整路径(包含驱动器号和所有内容),如果您使用反斜杠,请确保将它们加倍:
Well, the syntax of the Alias directive is quite straightforward:
... and the included example clarifies the rest:
The fact that you've tagged this as
PHP
suggests that you are either trying to setAlias
inside an.htaccess
file (which is simply not allowed, it needs to go in the main server config) or misinterpreting the directive as having something to do with file system symlinks (which is not, it only affect HTTP requests).Just type the full path (with drive letter and all) in whatever PHP function you are trying to use and, if you use back slashes, make sure you double them: